Gtkmm-PLplot 3.0
A scientific plotting library for Gtkmm
|
a class that will hold a single unbinned histogram dataset and its properties for a PlotHistogram plot More...
#include <gtkmm-plplot/plotdatahistogramunbinned.h>
Public Member Functions | |
PlotDataHistogramUnbinned (const std::vector< double > &data, double datmin, double datmax, int nbins) | |
PlotDataHistogramUnbinned (const std::valarray< double > &data, double datmin, double datmax, int nbins) | |
virtual | ~PlotDataHistogramUnbinned () |
virtual void | add_datapoint (double value) |
void | set_data_minimum (double datmin) |
void | set_data_maximum (double datmax) |
void | set_nbins (int nbins) |
bool | get_ignore_outliers () |
void | set_ignore_outliers (bool ignore_outliers) |
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 () |
Protected Member Functions | |
void | rebin () |
rebin the data | |
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 () | |
Protected Attributes | |
std::vector< double > | data |
unbinned data | |
bool | ignore_outliers |
flag that will determine what happens to outliers, i.e. data outside of datmin and datmax | |
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 | |
PlotDataHistogramUnbinned ()=delete | |
no default constructor | |
PlotDataHistogramUnbinned & | operator= (const PlotDataHistogramUnbinned &)=delete |
no assignment operator | |
PlotDataHistogramUnbinned (const PlotDataHistogramUnbinned &source)=delete | |
no default copy constructor; | |
Private Attributes | |
double * | x |
the X-values of the bins | |
double * | y |
the Y-values (heights) of the bins | |
a class that will hold a single unbinned histogram dataset and its properties for a PlotHistogram plot
Instances of this class contain a single dataset for a PlotHistogram plot using unbinned 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::PlotDataHistogramUnbinned::PlotDataHistogramUnbinned | ( | const std::vector< double > & | data, |
double | datmin, | ||
double | datmax, | ||
int | nbins | ||
) |
Constructor
This constructor initializes a new dataset for a PlotHistogram from unbinned data.
data | the unbinned data, as std::vector |
datmin | left-hand edge of the lowest-valued bin |
datmax | right-hand edge of the highest-valued bin |
nbins | number of bins into which to divide the data (minimum = 3) |
Gtk::PLplot::Exception |
Gtk::PLplot::PlotDataHistogramUnbinned::PlotDataHistogramUnbinned | ( | const std::valarray< double > & | data, |
double | datmin, | ||
double | datmax, | ||
int | nbins | ||
) |
Constructor
This constructor initializes a new dataset for a PlotHistogram from unbinned data.
data | the unbinned data, as std::valarray |
datmin | left-hand edge of the lowest-valued bin |
datmax | right-hand edge of the highest-valued bin |
nbins | number of bins into which to divide the data (minimum = 3) |
Gtk::PLplot::Exception |
|
virtual |
Destructor
|
virtual |
Add a single datapoint to the unbinned data
This will lead to the bins being recalculated, which will be reflected in the plot being updated.
value | a new value to add to the unbinned data |
|
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.
|
overridevirtual |
Get dataset extremes
Will be used in determining the box and its axes
Implements Gtk::PLplot::PlotDataHistogram.
bool Gtk::PLplot::PlotDataHistogramUnbinned::get_ignore_outliers | ( | ) |
Get whether outliers should be ignored or added to the lowest or highest-valued bins.
|
privatedelete |
no assignment operator
|
protected |
rebin the data
void Gtk::PLplot::PlotDataHistogramUnbinned::set_data_maximum | ( | double | datmax | ) |
Sets the right-hand edge of the highest-valued bin
This value must be more than the left-hand edge of the lowest-valued bin (obtained using get_data_minimum())
datmax | the new value |
Gtk::PLplot::Exception |
void Gtk::PLplot::PlotDataHistogramUnbinned::set_data_minimum | ( | double | datmin | ) |
Sets the left-hand edge of the lowest-valued bin
This value must be less than the right-hand edge of the highest-valued bin (obtained using get_data_maximum())
datmin | the new value |
Gtk::PLplot::Exception |
void Gtk::PLplot::PlotDataHistogramUnbinned::set_ignore_outliers | ( | bool | ignore_outliers | ) |
Sets whether outliers should be ignored or added to the lowest or highest-valued bins.
ignore_outliers | the new value |
void Gtk::PLplot::PlotDataHistogramUnbinned::set_nbins | ( | int | nbins | ) |
Sets the number of histogram bins
This value must be greater than or equal to 3
nbins | the new value |
Gtk::PLplot::Exception |
|
protected |
unbinned data
|
protected |
flag that will determine what happens to outliers, i.e. data outside of datmin and datmax
|
private |
the X-values of the bins
|
private |
the Y-values (heights) of the bins