Gtkmm-PLplot 3.0
A scientific plotting library for Gtkmm
|
a class that will hold a single binned histogram dataset and its properties for a PlotHistogram plot More...
#include <gtkmm-plplot/plotdatahistogrambinned.h>
Public Member Functions | |
PlotDataHistogramBinned (const std::vector< double > &data_x, const std::vector< double > &data_y, bool centred=false) | |
PlotDataHistogramBinned (const std::valarray< double > &data_x, const std::valarray< double > &data_y, bool centred=false) | |
virtual | ~PlotDataHistogramBinned () |
void | set_centred (bool centred) |
bool | get_centred () |
virtual void | draw_plot_data (const Cairo::RefPtr< Cairo::Context > &cr, plstream *pls) override |
virtual void | get_extremes (double &xmin, double &xmax, double &ymin, double &ymax) override |
Public Member Functions inherited from Gtk::PLplot::PlotDataHistogram | |
virtual | ~PlotDataHistogram () |
double | get_data_minimum () |
double | get_data_maximum () |
int | get_nbins () |
void | set_expand_bins (bool expand_bins) |
bool | get_expand_bins () |
void | set_empty_bins (bool empty_bins) |
bool | get_empty_bins () |
Public Member Functions inherited from Gtk::PLplot::PlotDataLine | |
virtual | ~PlotDataLine () |
void | set_color (Gdk::RGBA color) |
Gdk::RGBA | get_color () |
void | set_line_style (LineStyle line_style) |
LineStyle | get_line_style () |
void | set_line_width (double line_width) |
double | get_line_width () |
Public Member Functions inherited from Gtk::PLplot::PlotData | |
virtual | ~PlotData () |
void | set_name (Glib::ustring name) |
Glib::ustring | get_name () |
void | show () |
void | hide () |
bool | is_showing () const |
sigc::signal< void(void)> | signal_changed () |
sigc::signal< void(void)> | signal_data_modified () |
Public Member Functions inherited from Gtk::PLplot::Object | |
virtual void | set_manage () |
Static Protected Member Functions | |
static double | get_new_datmin (std::vector< double > data_x, bool centred) |
static method to calculate the data minumum | |
static double | get_new_datmax (std::vector< double > data_x, bool centred) |
static method to calculate the data maximum | |
Protected Attributes | |
std::vector< double > | data_x |
bin X-values, must be monotonicly increasing! | |
std::vector< double > | data_y |
bin Y-values (heights) | |
bool | centred |
if true , yhe bin boundaries are to be midway between the data_x values. If the values in data_x are equally spaced, the values are the center values of the bins. | |
Protected Attributes inherited from Gtk::PLplot::PlotDataHistogram | |
double | datmin |
Left-hand edge of the lowest-valued bin. | |
double | datmax |
Right-hand edge of the highest-valued bin. | |
int | nbins |
Number of bins into which to divide the data. | |
bool | expand_bins |
When false , the outer bins are drawn with equal size as the ones inside. | |
bool | empty_bins |
When false , bins with zero height are not drawn (there is a gap for such bins). | |
Protected Attributes inherited from Gtk::PLplot::PlotDataLine | |
Gdk::RGBA | color |
The color the dataset will be drawn in. | |
LineStyle | line_style |
The linestyle that will be used for this dataset in the plot. | |
double | line_width |
The line width of the dataset. Default is 1.0. | |
Protected Attributes inherited from Gtk::PLplot::PlotData | |
sigc::signal< void(void)> | _signal_changed |
signal that gets emitted whenever any of the dataset proprties is changed. | |
sigc::signal< void(void)> | _signal_data_modified |
signal that gets emitted whenever the X- and Y-datasets have been modified. | |
Private Member Functions | |
PlotDataHistogramBinned ()=delete | |
no default constructor | |
PlotDataHistogramBinned & | operator= (const PlotDataHistogramBinned &)=delete |
no assignment operator | |
PlotDataHistogramBinned (const PlotDataHistogramBinned &source)=delete | |
no default copy constructor | |
Additional Inherited Members | |
Protected Member Functions inherited from Gtk::PLplot::PlotDataHistogram | |
PlotDataHistogram (double datmin, double datmax, int nbins, bool expand_bins=true, bool empty_bins=true) | |
Protected Member Functions inherited from Gtk::PLplot::PlotDataLine | |
PlotDataLine (Gdk::RGBA color, LineStyle line_style, double line_width) | |
Protected Member Functions inherited from Gtk::PLplot::PlotData | |
virtual void | on_changed () |
virtual void | on_data_modified () |
PlotData () | |
Protected Member Functions inherited from Gtk::PLplot::Object | |
Object () | |
a class that will hold a single binned histogram dataset and its properties for a PlotHistogram plot
Instances of this class contain a single dataset for a PlotHistogram plot using binned data, along with a number of properties that will determine the appearance of the histogram. The constructors of this class allow to use either std::vector or std::valarray as sources of data, for added flexibility. Internally they are stored only as std::vector though. Important is that whenever a property is changed, signal_changed()
is emitted, which will eventually be picked up by the canvas
that will hold the plot. Several of the methods that are offered by this class are demonstrated in Example 12: Histograms
|
privatedelete |
no default constructor
|
privatedelete |
no default copy constructor
Gtk::PLplot::PlotDataHistogramBinned::PlotDataHistogramBinned | ( | const std::vector< double > & | data_x, |
const std::vector< double > & | data_y, | ||
bool | centred = false |
||
) |
Constructor
This constructor initializes a new dataset for a PlotHistogram from binned data.
data_x | the X-values of the bins, as std::vector |
data_y | the Y-values of the bins, as std::vector |
centred | if true , yhe bin boundaries are to be midway between the data_x values. If the values in data_x are equally spaced, the values are the center values of the bins. |
Gtk::PLplot::Exception |
Gtk::PLplot::PlotDataHistogramBinned::PlotDataHistogramBinned | ( | const std::valarray< double > & | data_x, |
const std::valarray< double > & | data_y, | ||
bool | centred = false |
||
) |
Constructor
This constructor initializes a new dataset for a PlotHistogram from binned data.
data_x | the X-values of the bins, as std::valarray |
data_y | the Y-values of the bins, as std::valarray |
centred | if true , yhe bin boundaries are to be midway between the data_x values. If the values in data_x are equally spaced, the values are the center values of the bins. |
Gtk::PLplot::Exception |
|
virtual |
Destructor
|
overridevirtual |
Method to draw the dataset
This method is virtual allowing inheriting classes to implement their own method with the same signature.
cr | the cairo context to draw to. |
pls | the PLplot plstream object that will do the actual plotting on the Cairo context |
Reimplemented from Gtk::PLplot::PlotData.
bool Gtk::PLplot::PlotDataHistogramBinned::get_centred | ( | ) |
Get the manner in which the X-values should be interpreted
If true
, yhe bin boundaries are to be midway between the data_x
values. If the values in data_x
are equally spaced, the values are the center values of the bins.
|
overridevirtual |
Get dataset extremes
Will be used in determining the box and its axes
Implements Gtk::PLplot::PlotDataHistogram.
|
staticprotected |
static method to calculate the data maximum
|
staticprotected |
static method to calculate the data minumum
|
privatedelete |
no assignment operator
void Gtk::PLplot::PlotDataHistogramBinned::set_centred | ( | bool | centred | ) |
Set the manner in which the X-values should be interpreted
If true
, yhe bin boundaries are to be midway between the data_x
values. If the values in data_x
are equally spaced, the values are the center values of the bins.
centred | new setting for X-values |
|
protected |
if true
, yhe bin boundaries are to be midway between the data_x
values. If the values in data_x
are equally spaced, the values are the center values of the bins.
|
protected |
bin X-values, must be monotonicly increasing!
|
protected |
bin Y-values (heights)