sciplot  0.3.1
A modern C++ plotting library powered by gnuplot
Canvas Class Reference

The class used to create multiple figures in one canvas. A canvas can be show on screen or output to file. More...

#include <Canvas.hpp>

Public Member Functions

 Canvas (const std::initializer_list< std::initializer_list< Figure >> &figures)
 Construct a Canvas object with given figures.
 
 Canvas (const std::vector< std::vector< Figure >> &figures)
 Construct a Canvas object with given figures.
 
Figureget (int i, int j)
 Get reference to figure object on canvas. More...
 
auto autoclean (bool enable=true) -> void
 Toggle automatic cleaning of temporary files (enabled by default). More...
 
auto defaultPalette (const std::string &name) -> Canvas &
 Set the default palette of colors for all plots that DO NOT have a palette set. More...
 
auto size (std::size_t width, std::size_t height) -> Canvas &
 Set the output size of the canvas (in unit of points, with 1 inch = 72 points).
 
auto fontName (std::string name) -> Canvas &
 Set the font name for all the plots on the canvas (e.g., Helvetica, Georgia, Times).
 
auto fontSize (std::size_t size) -> Canvas &
 Set the font size for all the plots on the canvas (e.g., 10, 12, 16).
 
auto title (const std::string &title) -> Canvas &
 Set the title of the canvas. More...
 
auto saveplotdata () const -> void
 Write the current plot data of all figures to the data file(s).
 
auto show () const -> void
 Show the canvas in a pop-up window. More...
 
auto save (const std::string &filename) const -> void
 Save the canvas to a file, with its extension defining the file format. More...
 
auto cleanup () const -> void
 Delete all files used to store plot data or scripts.
 

Detailed Description

The class used to create multiple figures in one canvas. A canvas can be show on screen or output to file.

Member Function Documentation

◆ get()

Figure & get ( int  i,
int  j 
)
inline

Get reference to figure object on canvas.

Note
Will throw if figure does not exist

◆ autoclean()

auto autoclean ( bool  enable = true) -> void
inline

Toggle automatic cleaning of temporary files (enabled by default).

Pass false if you want to keep your script / data files. Call cleanup() to remove those files manually.

◆ defaultPalette()

auto defaultPalette ( const std::string &  name) -> Canvas&
inline

Set the default palette of colors for all plots that DO NOT have a palette set.

Parameters
nameAny palette name displayed in https://github.com/Gnuplotting/gnuplot-palettes, such as "viridis", "parula", "jet".

◆ title()

auto title ( const std::string &  title) -> Canvas&
inline

Set the title of the canvas.

Note
This only work for show() atm!

◆ show()

auto show ( ) const -> void
inline

Show the canvas in a pop-up window.

Note
This method removes temporary files after saving if Canvas::autoclean(true) (default).

◆ save()

auto save ( const std::string &  filename) const -> void
inline

Save the canvas to a file, with its extension defining the file format.

The extension of the file name determines the file format. The supported formats are: pdf, eps, svg, png, and jpeg. Thus, to save the canvas in pdf format, choose a file name as in canvas.pdf.

Note
This method removes temporary files after saving if Canvas::autoclean(true) (default).

The documentation for this class was generated from the following file: