Gtkmm-PLplot 3.0
A scientific plotting library for Gtkmm
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
Gtk::PLplot::PlotDataHistogramUnbinned Class Reference

a class that will hold a single unbinned histogram dataset and its properties for a PlotHistogram plot More...

#include <gtkmm-plplot/plotdatahistogramunbinned.h>

Inheritance diagram for Gtk::PLplot::PlotDataHistogramUnbinned:
Inheritance graph
[legend]

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
 
PlotDataHistogramUnbinnedoperator= (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
 

Detailed Description

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

Constructor & Destructor Documentation

◆ PlotDataHistogramUnbinned() [1/4]

Gtk::PLplot::PlotDataHistogramUnbinned::PlotDataHistogramUnbinned ( )
privatedelete

no default constructor

◆ PlotDataHistogramUnbinned() [2/4]

Gtk::PLplot::PlotDataHistogramUnbinned::PlotDataHistogramUnbinned ( const PlotDataHistogramUnbinned source)
privatedelete

no default copy constructor;

◆ PlotDataHistogramUnbinned() [3/4]

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.

Parameters
datathe unbinned data, as std::vector
datminleft-hand edge of the lowest-valued bin
datmaxright-hand edge of the highest-valued bin
nbinsnumber of bins into which to divide the data (minimum = 3)
Exceptions
Gtk::PLplot::Exception

◆ PlotDataHistogramUnbinned() [4/4]

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.

Parameters
datathe unbinned data, as std::valarray
datminleft-hand edge of the lowest-valued bin
datmaxright-hand edge of the highest-valued bin
nbinsnumber of bins into which to divide the data (minimum = 3)
Exceptions
Gtk::PLplot::Exception

◆ ~PlotDataHistogramUnbinned()

virtual Gtk::PLplot::PlotDataHistogramUnbinned::~PlotDataHistogramUnbinned ( )
virtual

Destructor

Member Function Documentation

◆ add_datapoint()

virtual void Gtk::PLplot::PlotDataHistogramUnbinned::add_datapoint ( double  value)
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.

Parameters
valuea new value to add to the unbinned data

◆ draw_plot_data()

virtual void Gtk::PLplot::PlotDataHistogramUnbinned::draw_plot_data ( const Cairo::RefPtr< Cairo::Context > &  cr,
plstream *  pls 
)
overridevirtual

Method to draw the dataset

This method is virtual allowing inheriting classes to implement their own method with the same signature.

Parameters
crthe cairo context to draw to.
plsthe PLplot plstream object that will do the actual plotting on the Cairo context

Reimplemented from Gtk::PLplot::PlotData.

◆ get_extremes()

virtual void Gtk::PLplot::PlotDataHistogramUnbinned::get_extremes ( double &  xmin,
double &  xmax,
double &  ymin,
double &  ymax 
)
overridevirtual

Get dataset extremes

Will be used in determining the box and its axes

Implements Gtk::PLplot::PlotDataHistogram.

◆ get_ignore_outliers()

bool Gtk::PLplot::PlotDataHistogramUnbinned::get_ignore_outliers ( )

Get whether outliers should be ignored or added to the lowest or highest-valued bins.

Returns
the requested value

◆ operator=()

PlotDataHistogramUnbinned & Gtk::PLplot::PlotDataHistogramUnbinned::operator= ( const PlotDataHistogramUnbinned )
privatedelete

no assignment operator

◆ rebin()

void Gtk::PLplot::PlotDataHistogramUnbinned::rebin ( )
protected

rebin the data

◆ set_data_maximum()

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())

Parameters
datmaxthe new value
Exceptions
Gtk::PLplot::Exception

◆ set_data_minimum()

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())

Parameters
datminthe new value
Exceptions
Gtk::PLplot::Exception

◆ set_ignore_outliers()

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.

Parameters
ignore_outliersthe new value

◆ set_nbins()

void Gtk::PLplot::PlotDataHistogramUnbinned::set_nbins ( int  nbins)

Sets the number of histogram bins

This value must be greater than or equal to 3

Parameters
nbinsthe new value
Exceptions
Gtk::PLplot::Exception

Member Data Documentation

◆ data

std::vector<double> Gtk::PLplot::PlotDataHistogramUnbinned::data
protected

unbinned data

◆ ignore_outliers

bool Gtk::PLplot::PlotDataHistogramUnbinned::ignore_outliers
protected

flag that will determine what happens to outliers, i.e. data outside of datmin and datmax

◆ x

double* Gtk::PLplot::PlotDataHistogramUnbinned::x
private

the X-values of the bins

◆ y

double* Gtk::PLplot::PlotDataHistogramUnbinned::y
private

the Y-values (heights) of the bins