42 #ifndef TBTK_NUMPY_INITIALIZING_TRANSLATION_UNIT
43 # define NO_IMPORT_ARRAY
45 #define PY_ARRAY_UNIQUE_SYMBOL TBTK_PY_ARRAY_API
46 #define PY_UFUNC_UNIQUE_SYMBOL TBTK_PY_UFUNC_API
64 # define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
65 # include <numpy/arrayobject.h>
68 # include <opencv2/opencv.hpp>
69 # endif // WITH_OPENCV
75 # if CV_MAJOR_VERSION > 3
76 # define CV_BGR2RGB cv::COLOR_BGR2RGB
77 # define CV_BGRA2RGBA cv::COLOR_BGRA2RGBA
79 #endif // WITHOUT_NUMPY
81 #if PY_MAJOR_VERSION >= 3
82 # define PyString_FromString PyUnicode_FromString
83 # define PyInt_FromLong PyLong_FromLong
84 # define PyString_FromString PyUnicode_FromString
85 # define PyInt_FromString PyLong_FromString
89 namespace Visualization {
90 namespace MatPlotLib {
91 namespace matplotlibcpp {
94 extern std::string s_backend;
97 PyObject *s_python_function_show;
98 PyObject *s_python_function_close;
99 PyObject *s_python_function_draw;
100 PyObject *s_python_function_pause;
101 PyObject *s_python_function_save;
102 PyObject *s_python_function_figure;
103 PyObject *s_python_function_fignum_exists;
104 PyObject *s_python_function_plot;
105 PyObject *s_python_function_quiver;
106 PyObject *s_python_function_semilogx;
107 PyObject *s_python_function_semilogy;
108 PyObject *s_python_function_loglog;
109 PyObject *s_python_function_fill;
110 PyObject *s_python_function_fill_between;
111 PyObject *s_python_function_hist;
112 PyObject *s_python_function_imshow;
113 PyObject *s_python_function_scatter;
114 PyObject *s_python_function_subplot;
115 PyObject *s_python_function_subplot2grid;
116 PyObject *s_python_function_legend;
117 PyObject *s_python_function_xlim;
118 PyObject *s_python_function_ion;
119 PyObject *s_python_function_ginput;
120 PyObject *s_python_function_ylim;
121 PyObject *s_python_function_title;
122 PyObject *s_python_function_axis;
123 PyObject *s_python_function_xlabel;
124 PyObject *s_python_function_ylabel;
125 PyObject *s_python_function_xticks;
126 PyObject *s_python_function_yticks;
127 PyObject *s_python_function_grid;
128 PyObject *s_python_function_clf;
129 PyObject *s_python_function_errorbar;
130 PyObject *s_python_function_annotate;
131 PyObject *s_python_function_tight_layout;
132 PyObject *s_python_colormap;
133 PyObject *s_python_empty_tuple;
134 PyObject *s_python_function_stem;
135 PyObject *s_python_function_xkcd;
136 PyObject *s_python_function_text;
137 PyObject *s_python_function_suptitle;
138 PyObject *s_python_function_bar;
139 PyObject *s_python_function_subplots_adjust;
141 PyObject *s_python_function_gcf;
142 PyObject *s_python_function_gca;
143 PyObject *mpl_toolkitsmod;
147 static Interpreter& get();
149 void initializeMPLToolkits();
151 PyObject* safe_import(PyObject* module, std::string fname);
153 #ifndef WITHOUT_NUMPY
154 # if PY_MAJOR_VERSION >= 3
155 void *import_numpy();