All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
roboptim::visualization::Matplotlib Class Reference

matplotlib script More...

#include <roboptim/core/visualization/matplotlib.hh>

Public Member Functions

 ~Matplotlib ()
 
void push_command (const matplotlib::Command &cmd)
 Add a new matplotlib command to the script. More...
 
void push_import (const matplotlib::Import &import)
 Add a new Python import to the script. More...
 
std::ostream & print (std::ostream &) const
 Display the matplotlib script on the specified output stream. More...
 
Matplotliboperator<< (matplotlib::Command)
 
Matplotliboperator<< (matplotlib::Import)
 
void clear ()
 Clear the vectors of imports and commands. More...
 
bool & withHeader ()
 Whether to print the header (imports). More...
 
bool withHeader () const
 Whether to print the header (imports). More...
 
std::pair< int, int > & multiplot ()
 Plots layout. More...
 
std::pair< int, int > multiplot () const
 Plots layout. {1,1} if unspecified. More...
 

Static Public Member Functions

static Matplotlib make_matplotlib (std::pair< int, int > multiplot=std::make_pair(1, 1), bool with_header=true)
 Instanciate a matplotlib without setting a term. More...
 

Protected Member Functions

 Matplotlib (std::pair< int, int > multiplot=std::make_pair(1, 1), bool with_header=true)
 Default constructor can not be called directly. More...
 
void resetImports ()
 Reset imports to initial values. More...
 

Detailed Description

matplotlib script

This class gathers matplotlib commands to build a complete matplotlib script. matplotlib commands can be inserted through this object through the << operator and this object can be put into an output stream using the << operator.

Examples:
visualization-matplotlib-function.cc, and visualization-matplotlib-simple.cc.

Constructor & Destructor Documentation

roboptim::visualization::Matplotlib::~Matplotlib ( )
roboptim::visualization::Matplotlib::Matplotlib ( std::pair< int, int >  multiplot = std::make_pair(1, 1),
bool  with_header = true 
)
explicitprotected

Default constructor can not be called directly.

Use of the named constructor (see static methods) to instantiate this class.

References resetImports().

Member Function Documentation

void roboptim::visualization::Matplotlib::clear ( )

Clear the vectors of imports and commands.

References resetImports().

static Matplotlib roboptim::visualization::Matplotlib::make_matplotlib ( std::pair< int, int >  multiplot = std::make_pair(1, 1),
bool  with_header = true 
)
inlinestatic

Instanciate a matplotlib without setting a term.

Parameters
with_headerwhether to print the header or not
Returns
matplotlib instance
std::pair< int, int > & roboptim::visualization::Matplotlib::multiplot ( )

Plots layout.

{1,1} if unspecified.

Returns
Reference to multiplot_

Referenced by print().

std::pair< int, int > roboptim::visualization::Matplotlib::multiplot ( ) const

Plots layout. {1,1} if unspecified.

Matplotlib & roboptim::visualization::Matplotlib::operator<< ( matplotlib::Command  cmd)

References push_command().

Matplotlib & roboptim::visualization::Matplotlib::operator<< ( matplotlib::Import  import)

References push_import().

std::ostream & roboptim::visualization::Matplotlib::print ( std::ostream &  o) const

Display the matplotlib script on the specified output stream.

Parameters
ooutput stream used for display
Returns
output stream

References multiplot(), and withHeader().

Referenced by roboptim::visualization::operator<<().

void roboptim::visualization::Matplotlib::push_command ( const matplotlib::Command cmd)

Add a new matplotlib command to the script.

Parameters
cmdcommand that will be pushed

Referenced by operator<<(), and roboptim::visualization::operator<<().

void roboptim::visualization::Matplotlib::push_import ( const matplotlib::Import import)

Add a new Python import to the script.

Parameters
importpackage to import

Referenced by operator<<().

void roboptim::visualization::Matplotlib::resetImports ( )
protected

Reset imports to initial values.

Referenced by clear(), and Matplotlib().

bool & roboptim::visualization::Matplotlib::withHeader ( )

Whether to print the header (imports).

Returns
Reference to withHeader_.

Referenced by print().

bool roboptim::visualization::Matplotlib::withHeader ( ) const

Whether to print the header (imports).