Skip to content

plotpp::Multiplot

Public Types

Name
using std::vector< Figure >::iterator iterator
using std::vector< Figure >::const_iterator const_iterator

Public Functions

Name
void close()
Multiplot() =default
default constructor
Multiplot(Text title ="")
construct with title
Multiplot(size_t rows, size_t columns, Text title ="")
construct a multiplot
Multiplot(Multiplot && ) =default
move constructor
Multiplot & operator=(Multiplot && ) =default
move assignment
Figure & at(size_t row, size_t col)
Access a figure in the multiplot at a specific row and column index.
const Figure & at(size_t row, size_t col) const
Access a figure in the multiplot at a specific row and column index.
Multiplot & xLabel(const Text & xlabel)
sets the label of the x-axis for all sub-figures
Multiplot & yLabel(const Text & ylabel)
sets the label of the y-axis for all sub-figures
Multiplot & xMin(float v)
sets the minimum of the x-axis of all sub-figures
Multiplot & xMax(float v)
sets the maximum of the x-axis of all sub-figures
Multiplot & yMin(float v)
sets the minimum of the y-axis of all sub-figures
Multiplot & yMax(float v)
sets the maximum of the y-axis of all sub-figures
Multiplot & xlim(float x_min, float x_max)
sets the minumum and the maximum of the x-axis of all sub-figures
Multiplot & ylim(float y_min, float y_max)
sets the minumum and the maximum of the y-axis of all sub-figures
Multiplot & lim(float x_min, float x_max, float y_min, float y_max)
sets the minumum and the maximum of the x-axis and the y-axis of all sub-figures
Multiplot & xLog(bool b =true)
enables or disables log scaling for the x-axis of all sub-figures
Multiplot & yLog(bool b =true)
enables or disables log scaling for the y-axis of all sub-figures
Multiplot & xLogBase(float base)
sets the logarithmic base for the x-axis of all sub-figures
Multiplot & yLogBase(float base)
sets the logarithmic base for the y-axis of all sub-figures
Multiplot & xReverse(bool b =true)
enables or disables the reversal of the x-axis of all sub-figures
Multiplot & yReverse(bool b =true)
enables or disables the reversal of the y-axis of all sub-figures
Multiplot & xAutoscale(bool b =true)
enables or disables autoscaling of the x-axis for all sub-figures
Multiplot & yAutoscale(bool b =true)
enables or disables autoscaling of the y-axis for all sub-figures
Multiplot & autoscale(bool b =true)
enables or disables autoscaling of both axis for all sub-figures
Multiplot & showLegend(bool b =true)
enables or disables the legend of all sub-figures
Multiplot & xGrid(bool b =true)
Sets the x-axis grid on all sub-figures.
Multiplot & yGrid(bool b =true)
Sets the y-axis grid on all sub-figures.
Multiplot & grid(bool b =true)
Sets the grid on all sub-figures.
iterator begin()
const_iterator begin() const
const_iterator cbegin() const
iterator end()
const_iterator end() const
const_iterator cend() const
size_t size() const
size_t rows() const
size_t columns() const
Multiplot & resize(size_t rows, size_t columns)
resize the dimensions, number of rows and columns
const Multiplot & save(std::string filename ="", OutputFileType filetype =OutputFileType::NONE, TerminalType terminalType =TerminalType::NONE) const
Saves a figure to a file like: .png, .svg, .pdf, ... etc.
Multiplot & save(std::string filename ="", OutputFileType filetype =OutputFileType::NONE, TerminalType terminalType =TerminalType::NONE)
Multiplot & show(TerminalType terminalType =TerminalType::NONE)
Plots or re-plots the figure in a window.
Multiplot & show(OutputFileType filetype)
Plots or re-plots the figure in a window.
const Multiplot & plot(FILE * fptr, TerminalType terminalType =TerminalType::NONE, std::string saveAs ="") const
Plots the Multiplot to the provided file stream.
Multiplot & plot(FILE * fptr, TerminalType terminalType =TerminalType::NONE, std::string saveAs ="")

Public Types Documentation

using iterator

using plotpp::Multiplot::iterator =  std::vector<Figure>::iterator;

using const_iterator

using plotpp::Multiplot::const_iterator =  std::vector<Figure>::const_iterator;

Public Functions Documentation

function close

void close()

closes this figure. following calls to show() will thus create a new window. closes the pipe stream to the curren figure / gnuplot scession;

function Multiplot

Multiplot() =default

default constructor

function Multiplot

Multiplot(
    Text title =""
)

construct with title

Parameters:

  • title : Text - The title of the multiplot

function Multiplot

Multiplot(
    size_t rows,
    size_t columns,
    Text title =""
)

construct a multiplot

Parameters:

  • rows : size_t - The number of rows of figures
  • columns : size_t - The number of columns of figures
  • title : Text - The title of the multiplot

function Multiplot

Multiplot(
    Multiplot && 
) =default

move constructor

function operator=

Multiplot & operator=(
    Multiplot && 
) =default

move assignment

function at

Figure & at(
    size_t row,
    size_t col
)

Access a figure in the multiplot at a specific row and column index.

Parameters:

  • row : size_t - The row index (starts at 0)
  • col : size_t - The column index (starts at 0)

Return: Figure& - A reference to the figure at the [row, col] position

function at

const Figure & at(
    size_t row,
    size_t col
) const

Access a figure in the multiplot at a specific row and column index.

Parameters:

  • row : size_t - The row index (starts at 0)
  • col : size_t - The column index (starts at 0)

Return: Figure& - A reference to the figure at the [row, col] position

function xLabel

Multiplot & xLabel(
    const Text & xlabel
)

sets the label of the x-axis for all sub-figures

Parameters:

  • xlabel : Text - the new formated text

Return: Multiplot - reference to self

function yLabel

Multiplot & yLabel(
    const Text & ylabel
)

sets the label of the y-axis for all sub-figures

Parameters:

  • xlabel : Text - the new formated text

Return: Multiplot - reference to self

function xMin

Multiplot & xMin(
    float v
)

sets the minimum of the x-axis of all sub-figures

function xMax

Multiplot & xMax(
    float v
)

sets the maximum of the x-axis of all sub-figures

function yMin

Multiplot & yMin(
    float v
)

sets the minimum of the y-axis of all sub-figures

function yMax

Multiplot & yMax(
    float v
)

sets the maximum of the y-axis of all sub-figures

function xlim

Multiplot & xlim(
    float x_min,
    float x_max
)

sets the minumum and the maximum of the x-axis of all sub-figures

function ylim

Multiplot & ylim(
    float y_min,
    float y_max
)

sets the minumum and the maximum of the y-axis of all sub-figures

function lim

Multiplot & lim(
    float x_min,
    float x_max,
    float y_min,
    float y_max
)

sets the minumum and the maximum of the x-axis and the y-axis of all sub-figures

function xLog

Multiplot & xLog(
    bool b =true
)

enables or disables log scaling for the x-axis of all sub-figures

Parameters:

  • b : bool - if true enables logarithmic scaling of the x-axis and disables it otherwise

Return: Multiplot - reference to self

function yLog

Multiplot & yLog(
    bool b =true
)

enables or disables log scaling for the y-axis of all sub-figures

Parameters:

  • b : bool - if true enables logarithmic scaling of the y-axis and disables it otherwise

Return: Multiplot - reference to self

function xLogBase

Multiplot & xLogBase(
    float base
)

sets the logarithmic base for the x-axis of all sub-figures

Parameters:

  • base : float - the new base of the logarithm for axis scaling

Return: Multiplot - reference to self

Note: this function also activate logarithmic scaling like xLog(bool b) would

function yLogBase

Multiplot & yLogBase(
    float base
)

sets the logarithmic base for the y-axis of all sub-figures

Parameters:

  • base : float - the new base of the logarithm for axis scaling

Return: Multiplot - reference to self

Note: this function also activate logarithmic scaling like yLog(bool b) would

function xReverse

Multiplot & xReverse(
    bool b =true
)

enables or disables the reversal of the x-axis of all sub-figures

Parameters:

  • b : bool - if true (default) reverses the direction of the x-axis

Return: Multiplot - reference to self

function yReverse

Multiplot & yReverse(
    bool b =true
)

enables or disables the reversal of the y-axis of all sub-figures

Parameters:

  • b : bool - if true (default) reverses the direction of the y-axis

Return: Multiplot - reference to self

function xAutoscale

Multiplot & xAutoscale(
    bool b =true
)

enables or disables autoscaling of the x-axis for all sub-figures

Parameters:

  • b : bool - if true (default) enables autoscaling of the x-axis

Return: Multiplot - reference to self

function yAutoscale

Multiplot & yAutoscale(
    bool b =true
)

enables or disables autoscaling of the y-axis for all sub-figures

Parameters:

  • b : bool - if true (default) enables autoscaling of the y-axis

Return: Multiplot - reference to self

function autoscale

Multiplot & autoscale(
    bool b =true
)

enables or disables autoscaling of both axis for all sub-figures

Parameters:

  • b : bool - if true (default) enables autoscaling of both axis

Return: Multiplot - reference to self

function showLegend

Multiplot & showLegend(
    bool b =true
)

enables or disables the legend of all sub-figures

Parameters:

  • b : bool - if true (default) enables the legend

function xGrid

Multiplot & xGrid(
    bool b =true
)

Sets the x-axis grid on all sub-figures.

Parameters:

  • b : bool - if true (default) enables the grid else disables the grid

Return: Multiplot& - reference to self

function yGrid

Multiplot & yGrid(
    bool b =true
)

Sets the y-axis grid on all sub-figures.

Parameters:

  • b : bool - if true (default) enables the grid else disables the grid

Return: Multiplot& - reference to self

function grid

Multiplot & grid(
    bool b =true
)

Sets the grid on all sub-figures.

Parameters:

  • b : bool - if true (default) enables the grid else disables the grid

Return: Multiplot& - reference to self

function begin

iterator begin()

Return: the start iterator to iterate over the figures (Figure) contained in the multiplot

function begin

const_iterator begin() const

Return: the start iterator to iterate over the figures (Figure) contained in the multiplot

function cbegin

const_iterator cbegin() const

Return: the start iterator to iterate over the figures (Figure) contained in the multiplot

function end

iterator end()

Return: the end iterator to iterate over the figures (Figure) contained in the multiplot

function end

const_iterator end() const

Return: the end iterator to iterate over the figures (Figure) contained in the multiplot

function cend

const_iterator cend() const

Return: the end iterator to iterate over the figures (Figure) contained in the multiplot

function size

size_t size() const

Return: the number of figures contained in the multiplot

function rows

size_t rows() const

Return: the number of rows contained in the multiplot

function columns

size_t columns() const

Return: the number of columns contained in the multiplot

function resize

Multiplot & resize(
    size_t rows,
    size_t columns
)

resize the dimensions, number of rows and columns

Parameters:

  • rows : size_t - the new number of rows
  • columns : size_t the new number of columns

function save

const Multiplot & save(
    std::string filename ="",
    OutputFileType filetype =OutputFileType::NONE,
    TerminalType terminalType =TerminalType::NONE
) const

Saves a figure to a file like: .png, .svg, .pdf, ... etc.

Parameters:

  • filename : std::string - The filename as which the plot should be stored in. If the file type is provided in the name (e.g.: image file ".png", vector graphics ".svg", gnuplot script "*.gp") the filetype and TerminalType will be automatically deduced.
  • filetype : OutputFileType - The output file type like : .png, .svg, .pdf. If set to OutputFileType::NONE (default) it is derived from the provided filename ending.
  • terminalType : TerminalType - The terminal that gnuplot should use to create the file. If set to TerminalType::NONE it is derived from the filetype.

function save

inline Multiplot & save(
    std::string filename ="",
    OutputFileType filetype =OutputFileType::NONE,
    TerminalType terminalType =TerminalType::NONE
)

function show

Multiplot & show(
    TerminalType terminalType =TerminalType::NONE
)

Plots or re-plots the figure in a window.

Parameters:

  • terminalType : TerminalType - The terminal that gnuplot should use to creat the window and the plot. If TerminalType::NONE is provided, then gnuplot's default terminal will be used.

function show

Multiplot & show(
    OutputFileType filetype
)

Plots or re-plots the figure in a window.

Parameters:

  • filetype : OutputFileType - The file type as which the plot should be made and which should be used to deduce gnuplots plotting terminal from.

Like show(TerminalType terminalType) but will infere the terminal-type from the file-type. Except for the gnuplot script file type OutputFileType::gp. If that is provided the gnuplot script will be printed to stdout (the command line).

function plot

const Multiplot & plot(
    FILE * fptr,
    TerminalType terminalType =TerminalType::NONE,
    std::string saveAs =""
) const

Plots the Multiplot to the provided file stream.

Parameters:

  • fptr : FILE* - A filepointer to which the gnuplot script should be streamed to
  • terminalType : TerminalType - The terminal type that should be used for the plot. If TerminalType::NONE is provided, gnuplot's default one will be used
  • saveAs : std::string - [You should probably use save(std::string, OutputFileType, TerminalType) instead.] Filename under which to store the figure. If empty nothing will be stored. If not empty a command will be sent to save the current figure under that name. Note that this function will not derive the terminal type or plotting device from the file ending. So providing "plot.png", may not result in a PNG-file, if the wrong terminalType has been selected.

Will be used as a backend of save(std::string, OutputFileType, TerminalType) and show(TerminalType), that create a pipe stream to gnuplot that will then be fed the gnuplot script - so use those functions instead. Alternatively it can be used for debugging by providing stdout to the parameter fptr which will print the gnuplot script for the plot to the standard output (command line terminal).

function plot

inline Multiplot & plot(
    FILE * fptr,
    TerminalType terminalType =TerminalType::NONE,
    std::string saveAs =""
)

Updated on 2025-03-11 at 16:08:10 +0100