Namespace matplotlibcpp

namespace matplotlibcpp

Functions

inline void backend(const std::string &name)

Select the backend

NOTE: This must be called before the first plot command to have any effect.

Mainly useful to select the non-interactive ‘Agg’ backend when running matplotlibcpp in headless mode, for example on a machine with no display.

See also: https://matplotlib.org/2.0.2/api/matplotlib_configuration_api.html#matplotlib.use

inline bool annotate(std::string annotation, double x, double y)
template<typename Numeric>
bool plot(const std::vector<Numeric> &x, const std::vector<Numeric> &y, const std::map<std::string, std::string> &keywords)

Plot a line through the given x and y data points..

See: https://matplotlib.org/3.2.1/api/_as_gen/matplotlib.pyplot.plot.html

template<typename Numeric>
void plot_surface(const std::vector<::std::vector<Numeric>> &x, const std::vector<::std::vector<Numeric>> &y, const std::vector<::std::vector<Numeric>> &z, const std::map<std::string, std::string> &keywords = std::map<std::string, std::string>())
template<typename Numeric>
void plot3(const std::vector<Numeric> &x, const std::vector<Numeric> &y, const std::vector<Numeric> &z, const std::map<std::string, std::string> &keywords = std::map<std::string, std::string>())
template<typename Numeric>
bool stem(const std::vector<Numeric> &x, const std::vector<Numeric> &y, const std::map<std::string, std::string> &keywords)
template<typename Numeric>
bool fill(const std::vector<Numeric> &x, const std::vector<Numeric> &y, const std::map<std::string, std::string> &keywords)
template<typename Numeric>
bool fill_between(const std::vector<Numeric> &x, const std::vector<Numeric> &y1, const std::vector<Numeric> &y2, const std::map<std::string, std::string> &keywords)
template<typename Numeric>
bool hist(const std::vector<Numeric> &y, long bins = 10, std::string color = "b", double alpha = 1.0, bool cumulative = false)
inline void imshow(const unsigned char *ptr, const int rows, const int columns, const int colors, const std::map<std::string, std::string> &keywords = {}, PyObject **out = nullptr)
inline void imshow(const float *ptr, const int rows, const int columns, const int colors, const std::map<std::string, std::string> &keywords = {}, PyObject **out = nullptr)
template<typename NumericX, typename NumericY>
bool scatter(const std::vector<NumericX> &x, const std::vector<NumericY> &y, const double s = 1.0, const std::map<std::string, std::string> &keywords = {})
template<typename Numeric>
bool boxplot(const std::vector<std::vector<Numeric>> &data, const std::vector<std::string> &labels = {}, const std::map<std::string, std::string> &keywords = {})
template<typename Numeric>
bool boxplot(const std::vector<Numeric> &data, const std::map<std::string, std::string> &keywords = {})
template<typename Numeric>
bool bar(const std::vector<Numeric> &x, const std::vector<Numeric> &y, std::string ec = "black", std::string ls = "-", double lw = 1.0, const std::map<std::string, std::string> &keywords = {})
template<typename Numeric>
bool bar(const std::vector<Numeric> &y, std::string ec = "black", std::string ls = "-", double lw = 1.0, const std::map<std::string, std::string> &keywords = {})
inline bool subplots_adjust(const std::map<std::string, double> &keywords = {})
template<typename Numeric>
bool named_hist(std::string label, const std::vector<Numeric> &y, long bins = 10, std::string color = "b", double alpha = 1.0)
template<typename NumericX, typename NumericY>
bool plot(const std::vector<NumericX> &x, const std::vector<NumericY> &y, const std::string &s = "")
template<typename NumericX, typename NumericY, typename NumericU, typename NumericW>
bool quiver(const std::vector<NumericX> &x, const std::vector<NumericY> &y, const std::vector<NumericU> &u, const std::vector<NumericW> &w, const std::map<std::string, std::string> &keywords = {})
template<typename NumericX, typename NumericY>
bool stem(const std::vector<NumericX> &x, const std::vector<NumericY> &y, const std::string &s = "")
template<typename NumericX, typename NumericY>
bool semilogx(const std::vector<NumericX> &x, const std::vector<NumericY> &y, const std::string &s = "")
template<typename NumericX, typename NumericY>
bool semilogy(const std::vector<NumericX> &x, const std::vector<NumericY> &y, const std::string &s = "")
template<typename NumericX, typename NumericY>
bool loglog(const std::vector<NumericX> &x, const std::vector<NumericY> &y, const std::string &s = "")
template<typename NumericX, typename NumericY>
bool errorbar(const std::vector<NumericX> &x, const std::vector<NumericY> &y, const std::vector<NumericX> &yerr, const std::map<std::string, std::string> &keywords = {})
template<typename Numeric>
bool named_plot(const std::string &name, const std::vector<Numeric> &y, const std::string &format = "")
template<typename Numeric>
bool named_plot(const std::string &name, const std::vector<Numeric> &x, const std::vector<Numeric> &y, const std::string &format = "")
template<typename Numeric>
bool named_semilogx(const std::string &name, const std::vector<Numeric> &x, const std::vector<Numeric> &y, const std::string &format = "")
template<typename Numeric>
bool named_semilogy(const std::string &name, const std::vector<Numeric> &x, const std::vector<Numeric> &y, const std::string &format = "")
template<typename Numeric>
bool named_loglog(const std::string &name, const std::vector<Numeric> &x, const std::vector<Numeric> &y, const std::string &format = "")
template<typename Numeric>
bool plot(const std::vector<Numeric> &y, const std::string &format = "")
template<typename Numeric>
bool plot(const std::vector<Numeric> &y, const std::map<std::string, std::string> &keywords)
template<typename Numeric>
bool stem(const std::vector<Numeric> &y, const std::string &format = "")
template<typename Numeric>
void text(Numeric x, Numeric y, const std::string &s = "")
inline void colorbar(PyObject *mappable = NULL, const std::map<std::string, float> &keywords = {})
inline long figure(long number = -1)
inline bool fignum_exists(long number)
inline void figure_size(size_t w, size_t h)
inline void legend()
template<typename Numeric>
void ylim(Numeric left, Numeric right)
template<typename Numeric>
void xlim(Numeric left, Numeric right)
inline double *xlim()
inline double *ylim()
template<typename Numeric>
inline void xticks(const std::vector<Numeric> &ticks, const std::vector<std::string> &labels = {}, const std::map<std::string, std::string> &keywords = {})
template<typename Numeric>
inline void xticks(const std::vector<Numeric> &ticks, const std::map<std::string, std::string> &keywords)
template<typename Numeric>
inline void yticks(const std::vector<Numeric> &ticks, const std::vector<std::string> &labels = {}, const std::map<std::string, std::string> &keywords = {})
template<typename Numeric>
inline void yticks(const std::vector<Numeric> &ticks, const std::map<std::string, std::string> &keywords)
inline void tick_params(const std::map<std::string, std::string> &keywords, const std::string axis = "both")
inline void subplot(long nrows, long ncols, long plot_number)
inline void subplot2grid(long nrows, long ncols, long rowid = 0, long colid = 0, long rowspan = 1, long colspan = 1)
inline void title(const std::string &titlestr, const std::map<std::string, std::string> &keywords = {})
inline void suptitle(const std::string &suptitlestr, const std::map<std::string, std::string> &keywords = {})
inline void axis(const std::string &axisstr)
inline void axvline(double x, double ymin = 0., double ymax = 1., const std::map<std::string, std::string> &keywords_string = std::map<std::string, std::string>(), const std::map<std::string, double> &keywords_double = std::map<std::string, double>())
inline void xlabel(const std::string &str, const std::map<std::string, std::string> &keywords = {})
inline void ylabel(const std::string &str, const std::map<std::string, std::string> &keywords = {})
inline void set_zlabel(const std::string &str, const std::map<std::string, std::string> &keywords = {})
inline void grid(bool flag)
inline void show(const bool block = true)
inline void close()
inline void xkcd()
inline void draw()
template<typename Numeric>
inline void pause(Numeric interval)
inline void save(const std::string &filename)
inline void clf()
inline void ion()
inline std::vector<std::array<double, 2>> ginput(const int numClicks = 1, const std::map<std::string, std::string> &keywords = {})
inline void tight_layout()
template<typename ...Args>
bool plot()
template<typename A, typename B, typename ...Args>
bool plot(const A &a, const B &b, const std::string &format, Args... args)
inline bool plot(const std::vector<double> &x, const std::vector<double> &y, const std::string &format = "")
inline bool plot(const std::vector<double> &y, const std::string &format = "")
inline bool plot(const std::vector<double> &x, const std::vector<double> &y, const std::map<std::string, std::string> &keywords)
class Plot

Public Functions

template<typename Numeric>
inline Plot(const std::string &name, const std::vector<Numeric> &x, const std::vector<Numeric> &y, const std::string &format = "")
inline Plot(const std::string &name = "", const std::string &format = "")
template<typename Numeric>
inline bool update(const std::vector<Numeric> &x, const std::vector<Numeric> &y)
inline bool clear()
inline void remove()
inline ~Plot()
namespace detail

Typedefs

template<typename T>
using is_function = typename std::is_function<std::remove_pointer<std::remove_reference<T>>>::type

Functions

template<typename Numeric>
PyObject *get_array(const std::vector<Numeric> &v)
template<typename Numeric>
PyObject *get_2darray(const std::vector<::std::vector<Numeric>> &v)
inline PyObject *get_array(const std::vector<std::string> &strings)
template<typename Numeric>
PyObject *get_listlist(const std::vector<std::vector<Numeric>> &ll)
inline void imshow(void *ptr, const NPY_TYPES type, const int rows, const int columns, const int colors, const std::map<std::string, std::string> &keywords, PyObject **out)

Variables

static std::string s_backend
struct _interpreter

Public Functions

inline PyObject *safe_import(PyObject *module, std::string fname)

Public Members

PyObject *s_python_function_show
PyObject *s_python_function_close
PyObject *s_python_function_draw
PyObject *s_python_function_pause
PyObject *s_python_function_save
PyObject *s_python_function_figure
PyObject *s_python_function_fignum_exists
PyObject *s_python_function_plot
PyObject *s_python_function_quiver
PyObject *s_python_function_semilogx
PyObject *s_python_function_semilogy
PyObject *s_python_function_loglog
PyObject *s_python_function_fill
PyObject *s_python_function_fill_between
PyObject *s_python_function_hist
PyObject *s_python_function_imshow
PyObject *s_python_function_scatter
PyObject *s_python_function_boxplot
PyObject *s_python_function_subplot
PyObject *s_python_function_subplot2grid
PyObject *s_python_function_legend
PyObject *s_python_function_xlim
PyObject *s_python_function_ion
PyObject *s_python_function_ginput
PyObject *s_python_function_ylim
PyObject *s_python_function_title
PyObject *s_python_function_axis
PyObject *s_python_function_axvline
PyObject *s_python_function_xlabel
PyObject *s_python_function_ylabel
PyObject *s_python_function_gca
PyObject *s_python_function_xticks
PyObject *s_python_function_yticks
PyObject *s_python_function_tick_params
PyObject *s_python_function_grid
PyObject *s_python_function_clf
PyObject *s_python_function_errorbar
PyObject *s_python_function_annotate
PyObject *s_python_function_tight_layout
PyObject *s_python_colormap
PyObject *s_python_empty_tuple
PyObject *s_python_function_stem
PyObject *s_python_function_xkcd
PyObject *s_python_function_text
PyObject *s_python_function_suptitle
PyObject *s_python_function_bar
PyObject *s_python_function_colorbar
PyObject *s_python_function_subplots_adjust

Public Static Functions

static inline _interpreter &get()
template<typename T>
struct is_callable

Public Types

typedef is_callable_impl<std::is_class<T>::value, T>::type type
template<bool obj, typename T>
struct is_callable_impl
template<typename T>
struct is_callable_impl<false, T>

Public Types

typedef is_function<T> type
template<typename T>
struct is_callable_impl<true, T>

Public Types

typedef decltype(test<Derived>(nullptr)) type
typedef decltype(&Fallback::operator()) dtype

Public Static Functions

template<typename U>
static std::true_type test(...)
template<typename U>
static std::false_type test(Check<void (Fallback::*)(), &U::operator()>*)

Public Static Attributes

static constexpr bool value = type::value
template<typename U, U>
struct Check
template<>
struct Derived : public T, public matplotlibcpp::detail::is_callable_impl<true, T>::Fallback
template<>
struct Fallback

Subclassed by matplotlibcpp::detail::is_callable_impl< true, T >::Derived

Public Functions

void operator()()
template<typename IsYDataCallable>
struct plot_impl
template<>
struct plot_impl<std::false_type>

Public Functions

template<typename IterableX, typename IterableY>
inline bool operator()(const IterableX &x, const IterableY &y, const std::string &format)
template<>
struct plot_impl<std::true_type>

Public Functions

template<typename Iterable, typename Callable>
inline bool operator()(const Iterable &ticks, const Callable &f, const std::string &format)
template<typename T>
struct select_npy_type

Public Static Attributes

static const NPY_TYPES type = NPY_NOTYPE
template<>
struct select_npy_type<bool>

Public Static Attributes

static const NPY_TYPES type = NPY_BOOL
template<>
struct select_npy_type<double>

Public Static Attributes

static const NPY_TYPES type = NPY_DOUBLE
template<>
struct select_npy_type<float>

Public Static Attributes

static const NPY_TYPES type = NPY_FLOAT
template<>
struct select_npy_type<int16_t>

Public Static Attributes

static const NPY_TYPES type = NPY_SHORT
template<>
struct select_npy_type<int32_t>

Public Static Attributes

static const NPY_TYPES type = NPY_INT
template<>
struct select_npy_type<int64_t>

Public Static Attributes

static const NPY_TYPES type = NPY_INT64
template<>
struct select_npy_type<int8_t>

Public Static Attributes

static const NPY_TYPES type = NPY_INT8
template<>
struct select_npy_type<uint16_t>

Public Static Attributes

static const NPY_TYPES type = NPY_USHORT
template<>
struct select_npy_type<uint32_t>

Public Static Attributes

static const NPY_TYPES type = NPY_ULONG
template<>
struct select_npy_type<uint64_t>

Public Static Attributes

static const NPY_TYPES type = NPY_UINT64
template<>
struct select_npy_type<uint8_t>

Public Static Attributes

static const NPY_TYPES type = NPY_UINT8