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

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

#include <gtkmm-plplot/plotdatahistogrambinned.h>

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

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

Detailed Description

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

Constructor & Destructor Documentation

◆ PlotDataHistogramBinned() [1/4]

Gtk::PLplot::PlotDataHistogramBinned::PlotDataHistogramBinned ( )
privatedelete

no default constructor

◆ PlotDataHistogramBinned() [2/4]

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

no default copy constructor

◆ PlotDataHistogramBinned() [3/4]

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.

Parameters
data_xthe X-values of the bins, as std::vector
data_ythe Y-values of the bins, as std::vector
centredif 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.
Exceptions
Gtk::PLplot::Exception

◆ PlotDataHistogramBinned() [4/4]

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.

Parameters
data_xthe X-values of the bins, as std::valarray
data_ythe Y-values of the bins, as std::valarray
centredif 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.
Exceptions
Gtk::PLplot::Exception

◆ ~PlotDataHistogramBinned()

virtual Gtk::PLplot::PlotDataHistogramBinned::~PlotDataHistogramBinned ( )
virtual

Destructor

Member Function Documentation

◆ draw_plot_data()

virtual void Gtk::PLplot::PlotDataHistogramBinned::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_centred()

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.

Returns
the current setting for X-values

◆ get_extremes()

virtual void Gtk::PLplot::PlotDataHistogramBinned::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_new_datmax()

static double Gtk::PLplot::PlotDataHistogramBinned::get_new_datmax ( std::vector< double >  data_x,
bool  centred 
)
staticprotected

static method to calculate the data maximum

◆ get_new_datmin()

static double Gtk::PLplot::PlotDataHistogramBinned::get_new_datmin ( std::vector< double >  data_x,
bool  centred 
)
staticprotected

static method to calculate the data minumum

◆ operator=()

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

no assignment operator

◆ set_centred()

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.

Parameters
centrednew setting for X-values

Member Data Documentation

◆ centred

bool Gtk::PLplot::PlotDataHistogramBinned::centred
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.

◆ data_x

std::vector<double> Gtk::PLplot::PlotDataHistogramBinned::data_x
protected

bin X-values, must be monotonicly increasing!

◆ data_y

std::vector<double> Gtk::PLplot::PlotDataHistogramBinned::data_y
protected

bin Y-values (heights)