#include <gplot.h>
Classes | |
struct | plot_data_s |
Public Member Functions | |
gplot () | |
~gplot () | |
void | send2gp (const char *cmdstr) |
void | flush_cmd_buf (void) |
void | draw_now (void) |
void | figure (const int fig) |
void | window (const int fig, const char *name, const int x, const int y, const int width, const int height) |
void | window (const char *name, const int x, const int y, const int width, const int height) |
void | close_window (void) |
void | grid_on (void) |
void | grid_off (void) |
void | xlabel (const char *label) |
void | ylabel (const char *label) |
void | label (const double &x, const double &y, const char *label) |
void | title (const char *name) |
void | xlim (const double xmin, const double xmax) |
void | ylim (const double ymin, const double ymax) |
template<typename T1 , typename T2 > | |
void | plot_add (const T1 &x, const T2 &y, const std::string lb, const std::string ls="lines") |
template<typename T1 > | |
void | plot_add (const T1 &y, const std::string lb, const std::string ls="lines") |
void | plot_add_mat (const arma::mat &y) |
void | plot_add_mat (const arma::mat &y, const std::string p_lb) |
void | plot_show (void) |
void | plot_clear (void) |
template<typename T > | |
void | fast_plot (const arma::Col< T > &x, const std::string fmt_args="with lines") |
template<typename T > | |
void | fast_plot (const arma::Col< T > &x, const arma::Col< T > &y, const std::string fmt_args="with lines") |
template<typename T > | |
void | image (const arma::Mat< T > &x) |
template<typename T > | |
void | image (const arma::Cube< T > &x) |
template<typename T > | |
void | mesh (const arma::Mat< T > &x) |
template<typename T > | |
void | surf (const arma::Mat< T > &x) |
void | set_parula_line (void) |
void | set_jet_line (void) |
void | set_set1_line (void) |
void | set_jet_palette (void) |
void | set_parula_palette (void) |
void | set_coolwarm_palette (void) |
void | set_blackbody_palette (void) |
void | set_output (const char *name) |
void | reset_term (void) |
void | set_term (const char *ttype) |
Private Member Functions | |
template<typename T1 , typename T2 > | |
void | plot_str2 (const T1 &x, const T2 &y) |
template<typename T > | |
std::string | get_type (T x) |
Private Attributes | |
FILE * | gnucmd |
std::string | term |
int | fig_ix |
int | plot_ix |
std::vector< plot_data_s > | plotlist |
Implements a class for streaming data to Gnuplot using a pipe. Inspiration from https://code.google.com/p/gnuplot-cpp/
Requires Gnuplot version > 5.0
|
inline |
Constructor.
Opens a pipe to gnuplot program. Make sure it is found/accessable by the system.
Definition at line 102 of file gplot.h.
References err_handler.
|
inline |
|
inline |
|
inline |
Plot vector, fast version.
x | x vector |
Definition at line 426 of file gplot.h.
References flush_cmd_buf(), get_type(), and send2gp().
|
inline |
Plot vector, fast version.
x and y needs to have the same type
x | x vector |
y | y vector |
Definition at line 448 of file gplot.h.
References flush_cmd_buf(), get_type(), and send2gp().
|
inline |
|
inline |
Flush command buffer to Gnuplot pipe.
Definition at line 152 of file gplot.h.
Referenced by fast_plot(), image(), and mesh().
|
inlineprivate |
Get type.
x | x input type |
Definition at line 66 of file gplot.h.
References err_handler.
Referenced by fast_plot(), image(), and mesh().
|
inline |
|
inline |
Set grid.
Definition at line 225 of file gplot.h.
References send2gp().
Referenced by main().
|
inline |
Plot mat as image.
x | x matrix |
Definition at line 473 of file gplot.h.
References flush_cmd_buf(), get_type(), send2gp(), xlim(), and ylim().
Referenced by main().
|
inline |
Plot cube as image.
x | x matrix (R,G,B) |
Definition at line 492 of file gplot.h.
References flush_cmd_buf(), get_type(), send2gp(), xlim(), and ylim().
|
inline |
|
inline |
Plot mat as mesh.
x | x matrix |
Definition at line 524 of file gplot.h.
References flush_cmd_buf(), get_type(), and send2gp().
Referenced by surf().
|
inline |
Push plot y vs. x with label and linespec.
x | x vector |
y | y vector |
lb | label |
ls | line spec |
Definition at line 316 of file gplot.h.
References sp::gplot::plot_data_s::label, sp::gplot::plot_data_s::linespec, and plot_str2().
Referenced by main().
|
inline |
Push plot y vs. x with label and linespec.
y | y vector |
lb | label |
ls | line spec |
Definition at line 336 of file gplot.h.
References sp::gplot::plot_data_s::label, sp::gplot::plot_data_s::linespec, and plot_str2().
|
inline |
Push multiple plot, each row gives a plot without label.
y | y matrix |
Definition at line 354 of file gplot.h.
References sp::gplot::plot_data_s::label, sp::gplot::plot_data_s::linespec, and plot_str2().
Referenced by main().
|
inline |
Push multiple plot, each row gives a plot with prefix label.
y | y matrix |
p_lb | Label prefix |
Definition at line 374 of file gplot.h.
References sp::gplot::plot_data_s::label, sp::gplot::plot_data_s::linespec, and plot_str2().
|
inline |
Show plots.
Definition at line 395 of file gplot.h.
References plot_ix, and send2gp().
Referenced by main().
|
inlineprivate |
Plot y vs. x.
x | x vector |
y | y vector |
Definition at line 45 of file gplot.h.
References send2gp().
Referenced by plot_add(), and plot_add_mat().
|
inline |
|
inline |
Send command to Gnuplot pipe.
cmdstr | Command string |
Definition at line 141 of file gplot.h.
References gnucmd.
Referenced by close_window(), fast_plot(), figure(), grid_off(), grid_on(), image(), label(), main(), mesh(), plot_show(), plot_str2(), reset_term(), set_blackbody_palette(), set_coolwarm_palette(), set_jet_line(), set_jet_palette(), set_output(), set_parula_line(), set_parula_palette(), set_set1_line(), set_term(), surf(), title(), window(), xlabel(), xlim(), ylabel(), and ylim().
|
inline |
|
inline |
|
inline |
Set linetype to Matlab 'jet' NB! doesn't work with X11 -terminal Data from https://github.com/Gnuplotting/gnuplot-palettes.
Definition at line 566 of file gplot.h.
References send2gp().
|
inline |
Set palette to Matlab 'jet' Data from https://github.com/Gnuplotting/gnuplot-palettes.
Definition at line 608 of file gplot.h.
References send2gp().
|
inline |
Save plot to file.
name | filename |
Extensions that are supported:
Definition at line 695 of file gplot.h.
References send2gp(), and term.
Referenced by main().
|
inline |
Set linetype to Matlab 'parula' NB! doesn't work with X11 -terminal Data from https://github.com/Gnuplotting/gnuplot-palettes.
Definition at line 551 of file gplot.h.
References send2gp().
|
inline |
Set palette to Matlab 'parula' Data from https://github.com/Gnuplotting/gnuplot-palettes.
Definition at line 627 of file gplot.h.
References send2gp().
|
inline |
Set linetype to Matlab 'parula' NB! doesn't work with X11 -terminal Data from https://github.com/Gnuplotting/gnuplot-palettes.
Definition at line 580 of file gplot.h.
References send2gp().
|
inline |
Set output terminal.
Definition at line 759 of file gplot.h.
References send2gp().
Referenced by main().
|
inline |
|
inline |
|
inline |
Configure the figure used Windows environment.
fig | Figure number |
name | Window name |
x | x position of upper left corner |
y | y position of upper left corner |
width | width of window |
height | height of window |
Definition at line 182 of file gplot.h.
References send2gp().
Referenced by main(), and window().
|
inline |
Configure the figure/window - used in Linux environment where no figure numbers are needed.
name | Window name |
x | x position of upper left corner |
y | y position of upper left corner |
width | width of window |
height | height of window |
Definition at line 204 of file gplot.h.
References window().
|
inline |
Set label for X-axis.
label | label string |
Definition at line 236 of file gplot.h.
References send2gp().
Referenced by main().
|
inline |
|
inline |
Set label for X-axis.
label | label string |
Definition at line 248 of file gplot.h.
References send2gp().
Referenced by main().
|
inline |
|
private |
|
private |
Definition at line 31 of file gplot.h.
Referenced by plot_show().
|
private |
|
private |
Definition at line 29 of file gplot.h.
Referenced by set_output().