Multiplot  0.5.5
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
multiplot::Multiplot Class Reference

#include <multiplot.h>

Inheritance diagram for multiplot::Multiplot:
multiplot::Multiplot_base

Classes

class  Color3f
 
class  Point2d
 
class  Trace
 

Public Member Functions

 Multiplot (const int x, const int y, const int w, const int h, const std::wstring &title_str_=L"www.andre-krause.net/multiplot", bool fullscreen=false)
 
Traceoperator[] (int _trace)
 
Traceoperator() (int _trace)
 
Tracetrace (unsigned int _trace)
 
void plot (const float x, const float y)
 
template<class T >
void plot (const std::vector< T > &v)
 
template<class T >
void plot (const std::vector< T > &vx, const std::vector< T > &vy)
 
void color3f (float r, float g, float b)
 
void title (const std::wstring &title_)
 
void title (const std::string &title_)
 
void linewidth (float width)
 
void pointsize (float psize)
 
void scrolling (int max_points_to_plot)
 
void scaling (enum MP_SCALING sc, float x_min=-10, float x_max=10, float y_min=-10, float y_max=10)
 
void sleep (unsigned int milliseconds_)
 
void grid (enum MP_GRIDSTYLE ggridx=MP_LINEAR_GRID, enum MP_GRIDSTYLE ggridy=MP_LINEAR_GRID, float ggridx_step=-1.0, float ggridy_step=-1.0, float w=1.0)
 
void bg_color (float r, float g, float b)
 
void grid_color (float r, float g, float b)
 
void clear_all ()
 
void clear (int trace)
 
- Public Member Functions inherited from multiplot::Multiplot_base
 Multiplot_base (int x, int y, int w, int h, const std::wstring &title_, bool fullscreen_)
 
bool check ()
 
void caption (const std::string &t)
 
void caption (const std::wstring &t)
 
void redraw ()
 

Protected Member Functions

void initgl ()
 
Point2d draw_grid ()
 
virtual void draw ()
 

Protected Attributes

float cur_point_size = 0.0f
 
unsigned int cur_trace = 0
 
std::wstring title_str
 
std::wstring caption_str
 
Color3f bg_col { 0.0f, 0.0f, 0.0f }
 
Color3f grid_col { 0.8f, 0.8f, 0.8f }
 
MP_SCALING scaling_ = MP_AUTO_SCALE
 
Point2d range_min
 
Point2d range_max
 
Point2d minimum { -std::numeric_limits<float>::max() , -std::numeric_limits<float>::max() }
 
Point2d maximum { std::numeric_limits<float>::max() , std::numeric_limits<float>::max() }
 
Point2d scale
 
Point2d offset
 
std::vector< Tracetraces
 
int gridx = MP_NO_GRID
 
int gridy = MP_NO_GRID
 
float gridx_step = -1
 
float gridy_step = -1
 
float grid_linewidth = 1.0f
 
Point2d grid_spacing
 
- Protected Attributes inherited from multiplot::Multiplot_base
unsigned int width = 0
 
unsigned int height = 0
 
std::string caption_str
 

Detailed Description

this class creates a window to wich you can add an arbitrary number of autoscaling traces.

Member Function Documentation

◆ bg_color()

void multiplot::Multiplot::bg_color ( float  r,
float  g,
float  b 
)
inline

sets the background color

◆ clear()

void multiplot::Multiplot::clear ( int  trace)
inline

this function call clears trace number t

◆ clear_all()

void multiplot::Multiplot::clear_all ( )
inline

this function call simply clears all traces

◆ color3f()

void multiplot::Multiplot::color3f ( float  r,
float  g,
float  b 
)
inline

change current drawing color for current trace.

◆ grid()

void multiplot::Multiplot::grid ( enum MP_GRIDSTYLE  ggridx = MP_LINEAR_GRID,
enum MP_GRIDSTYLE  ggridy = MP_LINEAR_GRID,
float  ggridx_step = -1.0,
float  ggridy_step = -1.0,
float  w = 1.0 
)
inline

call this function if you wish a grid to be plotted in your graph. by default, no grids are plotted. call this function with the first two arguments set to either MP_NO_GRID, MP_LINEAR_GRID or MP_LOG_GRID. the next two arguments gridx_step and gridy_step specify the grid spacing. Zero or a negative value like -1 enables auto - spacing. The last parameter w sets the grid-linewidth. the default is 1 pixel.

◆ grid_color()

void multiplot::Multiplot::grid_color ( float  r,
float  g,
float  b 
)
inline

sets the grid color

◆ linewidth()

void multiplot::Multiplot::linewidth ( float  width)
inline

changes current line width.

◆ operator()()

Trace& multiplot::Multiplot::operator() ( int  _trace)
inline

Access function. allows direct access to a trace.

◆ operator[]()

Trace& multiplot::Multiplot::operator[] ( int  _trace)
inline

Access function. allows direct access to a trace.

◆ plot() [1/3]

void multiplot::Multiplot::plot ( const float  x,
const float  y 
)
inline

plots a point at x,y to the currently active trace. select a trace with a call to trace(int _tracenumber);

◆ plot() [2/3]

template<class T >
void multiplot::Multiplot::plot ( const std::vector< T > &  v)
inline

plots a vector of values to the currently active trace. the x value is running from 0 .. vector.size()-1 select a trace with a call to trace(int _tracenumber);

◆ plot() [3/3]

template<class T >
void multiplot::Multiplot::plot ( const std::vector< T > &  vx,
const std::vector< T > &  vy 
)
inline

plots the values of vector vx and vy to the currently active trace. vx and vy must have the same length. select a trace with a call to trace(int _tracenumber);

◆ pointsize()

void multiplot::Multiplot::pointsize ( float  psize)
inline

changes current point size.

◆ scaling()

void multiplot::Multiplot::scaling ( enum MP_SCALING  sc,
float  x_min = -10,
float  x_max = 10,
float  y_min = -10,
float  y_max = 10 
)
inline

changes the (auto-)scaling behaviour of the multiplot window. you can choose between MP_AUTO_SCALE MP_AUTO_SCALE_EQUAL MP_FIXED_SCALE

◆ scrolling()

void multiplot::Multiplot::scrolling ( int  max_points_to_plot)
inline

changes scrolling behaviour for current trace - see class Trace for details.

◆ sleep()

void multiplot::Multiplot::sleep ( unsigned int  milliseconds_)
inline

sleeps for the given amount of milliseconds useful to control the speed of animated graphs.

◆ title() [1/2]

void multiplot::Multiplot::title ( const std::wstring &  title_)
inline

sets the window title given a wide string.

◆ title() [2/2]

void multiplot::Multiplot::title ( const std::string &  title_)
inline

sets the window title given a string or char*.

◆ trace()

Trace& multiplot::Multiplot::trace ( unsigned int  _trace)
inline

sets the current trace. traces are numbered from zero to N. memory for the traces is automatically allocated.


The documentation for this class was generated from the following file: