Gtkmm-PLplot 3.0
A scientific plotting library for Gtkmm
|
an abstract base class for all plots More...
#include <gtkmm-plplot/plot.h>
Public Member Functions | |
virtual | ~Plot () |
virtual void | remove_data (unsigned int plot_data_index) |
virtual void | remove_data (PlotData &plot_data_member) |
virtual void | remove_object (unsigned int plot_object_index) |
virtual void | remove_object (PlotObject &plot_object_member) |
virtual PlotData * | get_data (unsigned int data_index=0) final |
virtual void | draw_plot (const Cairo::RefPtr< Cairo::Context > &cr, const int width, const int height)=0 |
void | set_axis_title_x (Glib::ustring title) |
void | set_axis_title_y (Glib::ustring title) |
Glib::ustring | get_axis_title_x () |
Glib::ustring | get_axis_title_y () |
void | set_plot_title (Glib::ustring title) |
Glib::ustring | get_plot_title () |
void | show () |
void | hide () |
bool | is_showing () const |
Gdk::RGBA | get_background_color () |
void | set_background_color (Gdk::RGBA color) |
Gdk::RGBA | get_axes_color () |
void | set_axes_color (Gdk::RGBA color) |
Gdk::RGBA | get_titles_color () |
void | set_titles_color (Gdk::RGBA color) |
sigc::signal< void(void)> | signal_changed () |
sigc::signal< void(PlotData *)> | signal_data_added () |
sigc::signal< void(PlotData *)> | signal_data_removed () |
sigc::signal< void(PlotObject *)> | signal_object_added () |
sigc::signal< void(PlotObject *)> | signal_object_removed () |
Public Member Functions inherited from Gtk::PLplot::Object | |
virtual void | set_manage () |
Protected Member Functions | |
virtual void | plot_data_modified ()=0 |
a method that will update the _range variables when datasets are added, modified or removed. | |
virtual void | on_changed () |
virtual void | on_data_added (PlotData *new_data) |
virtual void | on_data_removed (PlotData *removed_data) |
virtual void | on_object_added (PlotObject *new_object) |
virtual void | on_object_removed (PlotObject *removed_object) |
virtual void | draw_plot_init (const Cairo::RefPtr< Cairo::Context > &cr, const int width, const int height) final |
Plot (const Glib::ustring &axis_title_x, const Glib::ustring &axis_title_y, const Glib::ustring &plot_title, const double plot_width_norm, const double plot_height_norm, const double plot_offset_horizontal_norm, const double plot_offset_vertical_norm) | |
Protected Member Functions inherited from Gtk::PLplot::Object | |
Object () | |
Protected Attributes | |
std::vector< PlotData * > | plot_data |
vector that contains pointers to the PlotData datasets | |
std::vector< PlotObject * > | plot_objects |
vector that contains pointers to the PlotObject datasets | |
Glib::ustring | axis_title_x |
X-axis title. | |
Glib::ustring | axis_title_y |
Y-axis title. | |
Glib::ustring | plot_title |
Plot title. | |
plstream * | pls |
the plstream object that will ensure the connection with PLplot | |
int | canvas_width |
the width of the canvas in Cairo units | |
int | canvas_height |
the height of the canvas in Cairo units | |
int | plot_offset_x |
the offset of the plot with respect to the top left corner of the canvas, measured along the horizontal (X-) axis in Cairo units | |
int | plot_offset_y |
the offset of the plot with respect to the top left corner of the canvas, measured along the vertical (Y-) axis in Cairo units | |
int | plot_width |
the current width of the plot in Cairo units | |
int | plot_height |
the current height of the plot in Cairo units | |
bool | shown |
true means the plot is currently visible, false means it is not plotted | |
Gdk::RGBA | background_color |
the currently used background color of the plot (default = fully transparent white, meaning that the background will be determined by the canvas) | |
const double | plot_width_norm |
the normalized plot width, calculated relative to the canvas width | |
const double | plot_height_norm |
the normalized plot height, calculated relative to the canvas height | |
const double | plot_offset_horizontal_norm |
the normalized horizontal offset from the canvas top left corner, calculated relative to the canvas width | |
const double | plot_offset_vertical_norm |
the normalized vertical offset from the canvas top left corner, calculated relative to the canvas height | |
Gdk::RGBA | axes_color |
the currently used color to draw the axes, the box and gridlines. Default is opaque black | |
Gdk::RGBA | titles_color |
the currently used color to draw the axes and plot titles. Default is opaque black | |
sigc::signal< void(void)> | _signal_changed |
signal that gets emitted whenever any of the plot parameters, or any of the contained PlotData datasets is changed. | |
sigc::signal< void(PlotData *)> | _signal_data_added |
signal emitted whenever a PlotData dataset is added to the plot | |
sigc::signal< void(PlotData *)> | _signal_data_removed |
signal emitted whenever data is removed from the plot. | |
sigc::signal< void(PlotObject *)> | _signal_object_added |
signal emitted whenever a PlotObject is added to the plot | |
sigc::signal< void(PlotObject *)> | _signal_object_removed |
signal emitted whenever a PlotObject is removed from the plot. | |
Private Member Functions | |
Plot & | operator= (const Plot &)=delete |
no assignment operator | |
Plot (const Plot &)=delete | |
no default copy constructor | |
Plot ()=delete | |
Friends | |
class | Canvas |
class | RegionSelection |
an abstract base class for all plots
This is the base class from which all other plots classes are derived. It contains several pure virtual methods that have to be implemented by all derived classes. This class cannot be instantiated directly, meaning that instances returned by Canvas::get_plot() and Canvas::add_plot() need to be cast to access methods offered only by the derived class.
|
privatedelete |
no default copy constructor
|
privatedelete |
|
protected |
Constructor
This class provides a single constructor, which takes an existing PlotData dataset to construct a plot. Optionally, the constructor takes additional arguments to set the axes and plot titles, as well as normalized coordinates that will determine the position and dimensions of the plot within the canvas. The default corresponds to the plot taking up the full space.
axis_title_x | X-axis title |
axis_title_y | Y-axis title |
plot_title | plot title |
plot_width_norm | the normalized plot width, calculated relative to the canvas width |
plot_height_norm | the normalized plot height, calculated relative to the canvas height |
plot_offset_horizontal_norm | the normalized horizontal offset from the canvas top left corner, calculated relative to the canvas width |
plot_offset_vertical_norm | the normalized vertical offset from the canvas top left corner, calculated relative to the canvas height |
|
virtual |
Destructor
|
pure virtual |
Method to draw the plot with all of its datasets
This method is virtual allowing inheriting classes to implement their own method with the same signature.
cr | the cairo context to draw to. |
width | the width of the Canvas widget |
height | the height of the Canvas widget |
Implemented in Gtk::PLplot::Plot2D, Gtk::PLplot::Plot3D, Gtk::PLplot::PlotContour, Gtk::PLplot::PlotContourShades, Gtk::PLplot::PlotHistogram, and Gtk::PLplot::PlotPolar.
|
finalprotectedvirtual |
Initialization method for draw_plot.
Should be called by all draw_plot() methods in derived classes.
cr | Cairo context |
width | width of the plot in normalized coordinates |
height | height of the plot in normalized coordinates |
Gdk::RGBA Gtk::PLplot::Plot::get_axes_color | ( | ) |
Get the color to draw the axes, the box and gridlines
Glib::ustring Gtk::PLplot::Plot::get_axis_title_x | ( | ) |
Get the X-axis title
Glib::ustring Gtk::PLplot::Plot::get_axis_title_y | ( | ) |
Get the Y-axis title
Gdk::RGBA Gtk::PLplot::Plot::get_background_color | ( | ) |
Get the plot background color
|
finalvirtual |
Get a pointer to a dataset included in the plot
Throws an exception when data_index
is invalid.
data_index | index of the dataset in the plot_data vector |
plot_data
vector. Gtk::PLplot::Exception |
Glib::ustring Gtk::PLplot::Plot::get_plot_title | ( | ) |
Get the plot title
Gdk::RGBA Gtk::PLplot::Plot::get_titles_color | ( | ) |
Get the color to draw the plot and axes titles
void Gtk::PLplot::Plot::hide | ( | ) |
Hide the plot on the canvas
bool Gtk::PLplot::Plot::is_showing | ( | ) | const |
Returns whether or not the plot is showing on the canvas
true
if the plot is visible, false
if not
|
protectedvirtual |
This is a default handler for signal_changed()
This signal is emitted whenever any of the plot properties, or the properties of the PlotData datasets therein, is changed. Currently it does nothing but the signal will get caught by Canvas, and will eventually trigger a redrawing of the entire widget.
|
protectedvirtual |
This is a default handler for signal_data_added()
This signal is emitted whenever a new PlotData dataset is added to the plot. It will call the private method plot_data_modified, which will update *_range_*
properties, and emit signal_changed.
new_data | a pointer to the newly added PlotData dataset, after it has been added to the plot_data vector. |
|
protectedvirtual |
This is a default handler for signal_data_removed()
This signal is emitted whenever a PlotData dataset is removed from the plot with remove_data. It will first delete removed_data, provided its memory is managed, followed by a call to the private method plot_data_modified, which will update *_range_*
properties, and emit signal_changed.
removed_data | a pointer to the PlotData dataset that was just removed. It should be deleted in this method or a memory leak will be created. |
|
protectedvirtual |
This is a default handler for signal_object_added()
This signal is emitted whenever a new PlotObject instance is added to the plot.
new_object | a pointer to the newly added PlotObject instance, after it has been added to the plot_objects vector. |
|
protectedvirtual |
This is a default handler for signal_object_removed()
This signal is emitted whenever a PlotObject instance is removed from the plot with remove_object. It will first delete removed_object, provided its memory is managed, followed by a emitting signal_changed.
removed_object | a pointer to the PlotObject objectset that was just removed. It should be deleted in this method or a memory leak will be created. |
|
protectedpure virtual |
a method that will update the _range
variables when datasets are added, modified or removed.
Implemented in Gtk::PLplot::Plot2D, Gtk::PLplot::Plot3D, Gtk::PLplot::PlotContour, Gtk::PLplot::PlotHistogram, and Gtk::PLplot::PlotPolar.
|
virtual |
Remove a single dataset from the plot
plot_data_member | pointer to the plotdata in the plot_data vector |
Gtk::PLplot::Exception |
Reimplemented in Gtk::PLplot::Plot2D, and Gtk::PLplot::PlotPolar.
|
virtual |
Remove a single dataset from the plot
plot_data_index | index of the plotdata in the plot_data vector |
Gtk::PLplot::Exception |
Reimplemented in Gtk::PLplot::Plot2D, and Gtk::PLplot::PlotPolar.
|
virtual |
Remove a single object from the plot
plot_object_member | pointer to the plotobject in the plot_data vector |
Gtk::PLplot::Exception |
|
virtual |
Remove a single object from the plot
plot_object_index | index of the plotobject in the plot_objects vector |
Gtk::PLplot::Exception |
void Gtk::PLplot::Plot::set_axes_color | ( | Gdk::RGBA | color | ) |
Set the color to draw the axes, the box and gridlines
color | Set a new axes color. |
void Gtk::PLplot::Plot::set_axis_title_x | ( | Glib::ustring | title | ) |
Set the X-axis title
title | the new X-axis title |
void Gtk::PLplot::Plot::set_axis_title_y | ( | Glib::ustring | title | ) |
Set the Y-axis title
title | the new Y-axis title |
void Gtk::PLplot::Plot::set_background_color | ( | Gdk::RGBA | color | ) |
Set the background color
color | Set a new plot background color. |
void Gtk::PLplot::Plot::set_plot_title | ( | Glib::ustring | title | ) |
Set the plot title
title | the new plot title (may be an empty string) |
void Gtk::PLplot::Plot::set_titles_color | ( | Gdk::RGBA | color | ) |
Set the color to draw the plot and axes titles
color | Set a new titles color. |
void Gtk::PLplot::Plot::show | ( | ) |
Make the plot visible on the canvas
|
inline |
signal_changed is emitted whenever any of the plot properties or any of the dataset properties has changed.
See default handler on_changed()
|
inline |
signal_data_added is emitted whenever a new dataset is added to the plot
See default handler on_data_added()
|
inline |
signal_data_removed is emitted whenever a dataset is removed from the plot
See default handler on_data_removed()
|
inline |
signal_object_added is emitted whenever a new object is added to the plot
See default handler on_object_added()
|
inline |
signal_object_removed is emitted whenever an object is removed from the plot
See default handler on_object_removed()
|
friend |
|
friend |
|
protected |
signal that gets emitted whenever any of the plot parameters, or any of the contained PlotData datasets is changed.
|
protected |
signal emitted whenever a PlotData dataset is added to the plot
|
protected |
signal emitted whenever data is removed from the plot.
|
protected |
signal emitted whenever a PlotObject is added to the plot
|
protected |
signal emitted whenever a PlotObject is removed from the plot.
|
protected |
the currently used color to draw the axes, the box and gridlines. Default is opaque black
|
protected |
X-axis title.
|
protected |
Y-axis title.
|
protected |
the currently used background color of the plot (default = fully transparent white, meaning that the background will be determined by the canvas)
|
protected |
the height of the canvas in Cairo units
|
protected |
the width of the canvas in Cairo units
|
protected |
vector that contains pointers to the PlotData datasets
|
protected |
the current height of the plot in Cairo units
|
protected |
the normalized plot height, calculated relative to the canvas height
|
protected |
vector that contains pointers to the PlotObject datasets
|
protected |
the normalized horizontal offset from the canvas top left corner, calculated relative to the canvas width
|
protected |
the normalized vertical offset from the canvas top left corner, calculated relative to the canvas height
|
protected |
the offset of the plot with respect to the top left corner of the canvas, measured along the horizontal (X-) axis in Cairo units
|
protected |
the offset of the plot with respect to the top left corner of the canvas, measured along the vertical (Y-) axis in Cairo units
|
protected |
Plot title.
|
protected |
the current width of the plot in Cairo units
|
protected |
the normalized plot width, calculated relative to the canvas width
|
protected |
the plstream
object that will ensure the connection with PLplot
|
protected |
true
means the plot is currently visible, false
means it is not plotted
|
protected |
the currently used color to draw the axes and plot titles. Default is opaque black