Giter VIP home page Giter VIP logo

matplotlib-cpp's Introduction

matplotlib-cpp

Welcome to matplotlib-cpp, possibly the simplest C++ plotting library. It is built to resemble the plotting API used by Matlab and matplotlib.

Usage

Complete minimal example:

#include "matplotlibcpp.h"
namespace plt = matplotlibcpp;
int main() {
    plt::plot({1,3,2,4});
    plt::show();
}
g++ minimal.cpp -std=c++11 -I/usr/include/python2.7 -lpython2.7

Result:

Minimal example

A more comprehensive example:

#include "matplotlibcpp.h"
#include <cmath>

namespace plt = matplotlibcpp;

int main()
{
    // Prepare data.
    int n = 5000;
    std::vector<double> x(n), y(n), z(n), w(n,2);
    for(int i=0; i<n; ++i) {
        x.at(i) = i*i;
        y.at(i) = sin(2*M_PI*i/360.0);
        z.at(i) = log(i);
    }

    // Set the size of output image to 1200x780 pixels
    plt::figure_size(1200, 780);
    // Plot line from given x and y data. Color is selected automatically.
    plt::plot(x, y);
    // Plot a red dashed line from given x and y data.
    plt::plot(x, w,"r--");
    // Plot a line whose name will show up as "log(x)" in the legend.
    plt::named_plot("log(x)", x, z);
    // Set x-axis to interval [0,1000000]
    plt::xlim(0, 1000*1000);
    // Add graph title
    plt::title("Sample figure");
    // Enable legend.
    plt::legend();
    // Save the image (file format is determined by the extension)
    plt::save("./basic.png");
}
g++ basic.cpp -I/usr/include/python2.7 -lpython2.7

Result:

Basic example

Alternatively, matplotlib-cpp also supports some C++11-powered syntactic sugar:

#include <cmath>
#include "matplotlibcpp.h"

using namespace std;
namespace plt = matplotlibcpp;

int main()
{
    // Prepare data.
    int n = 5000; // number of data points
    vector<double> x(n),y(n);
    for(int i=0; i<n; ++i) {
        double t = 2*M_PI*i/n;
        x.at(i) = 16*sin(t)*sin(t)*sin(t);
        y.at(i) = 13*cos(t) - 5*cos(2*t) - 2*cos(3*t) - cos(4*t);
    }

    // plot() takes an arbitrary number of (x,y,format)-triples.
    // x must be iterable (that is, anything providing begin(x) and end(x)),
    // y must either be callable (providing operator() const) or iterable.
    plt::plot(x, y, "r-", x, [](double d) { return 12.5+abs(sin(d)); }, "k-");


    // show plots
    plt::show();
}
g++ modern.cpp -std=c++11 -I/usr/include/python2.7 -lpython

Result:

Modern example

Or some funny-looking xkcd-styled example:

#include "matplotlibcpp.h"
#include <vector>
#include <cmath>

namespace plt = matplotlibcpp;

int main() {
    std::vector<double> t(1000);
    std::vector<double> x(t.size());

    for(size_t i = 0; i < t.size(); i++) {
        t[i] = i / 100.0;
        x[i] = sin(2.0 * M_PI * 1.0 * t[i]);
    }

    plt::xkcd();
    plt::plot(t, x);
    plt::title("AN ORDINARY SIN WAVE");
    plt::save("xkcd.png");
}
g++ xkcd.cpp -std=c++11 -I/usr/include/python2.7 -lpython2.7

Result:

xkcd example

When working with vector fields, you might be interested in quiver plots:

#include "../matplotlibcpp.h"

namespace plt = matplotlibcpp;

int main()
{
    // u and v are respectively the x and y components of the arrows we're plotting
    std::vector<int> x, y, u, v;
    for (int i = -5; i <= 5; i++) {
        for (int j = -5; j <= 5; j++) {
            x.push_back(i);
            u.push_back(-i);
            y.push_back(j);
            v.push_back(-j);
        }
    }

    plt::quiver(x, y, u, v);
    plt::show();
}
g++ quiver.cpp -std=c++11 -I/usr/include/python2.7 -lpython2.7

Result:

quiver example

When working with 3d functions, you might be interested in 3d plots:

#include "../matplotlibcpp.h"

namespace plt = matplotlibcpp;

int main()
{
    std::vector<std::vector<double>> x, y, z;
    for (double i = -5; i <= 5;  i += 0.25) {
        std::vector<double> x_row, y_row, z_row;
        for (double j = -5; j <= 5; j += 0.25) {
            x_row.push_back(i);
            y_row.push_back(j);
            z_row.push_back(::std::sin(::std::hypot(i, j)));
        }
        x.push_back(x_row);
        y.push_back(y_row);
        z.push_back(z_row);
    }

    plt::plot_surface(x, y, z);
    plt::show();
}

Result:

surface example

Installation

matplotlib-cpp works by wrapping the popular python plotting library matplotlib. (matplotlib.org) This means you have to have a working python installation, including development headers. On Ubuntu:

sudo apt-get install python-matplotlib python-numpy python2.7-dev

If, for some reason, you're unable to get a working installation of numpy on your system, you can define the macro WITHOUT_NUMPY before including the header file to erase this dependency.

The C++-part of the library consists of the single header file matplotlibcpp.h which can be placed anywhere.

Since a python interpreter is opened internally, it is necessary to link against libpython in order to user matplotlib-cpp. Most versions should work, although python likes to randomly break compatibility from time to time so some caution is advised when using the bleeding edge.

CMake

The C++ code is compatible to both python2 and python3. However, the CMakeLists.txt file is currently set up to use python3 by default, so if python2 is required this has to be changed manually. (a PR that adds a cmake option for this would be highly welcomed)

NOTE: By design (of python), only a single python interpreter can be created per process. When using this library, no other library that is spawning a python interpreter internally can be used.

To compile the code without using cmake, the compiler invocation should look like this:

g++ example.cpp -I/usr/include/python2.7 -lpython2.7

This can also be used for linking against a custom build of python

g++ example.cpp -I/usr/local/include/fancy-python4 -L/usr/local/lib -lfancy-python4

Vcpkg

You can download and install matplotlib-cpp using the vcpkg dependency manager:

git clone https://github.com/Microsoft/vcpkg.git
cd vcpkg
./bootstrap-vcpkg.sh
./vcpkg integrate install
vcpkg install matplotlib-cpp

The matplotlib-cpp port in vcpkg is kept up to date by Microsoft team members and community contributors. If the version is out of date, please create an issue or pull request on the vcpkg repository.

C++11

Currently, c++11 is required to build matplotlib-cpp. The last working commit that did not have this requirement was 717e98e752260245407c5329846f5d62605eff08.

Note that support for c++98 was dropped more or less accidentally, so if you have to work with an ancient compiler and still want to enjoy the latest additional features, I'd probably merge a PR that restores support.

Why?

I initially started this library during my diploma thesis. The usual approach of writing data from the c++ algorithm to a file and afterwards parsing and plotting it in python using matplotlib proved insufficient: Keeping the algorithm and plotting code in sync requires a lot of effort when the C++ code frequently and substantially changes. Additionally, the python yaml parser was not able to cope with files that exceed a few hundred megabytes in size.

Therefore, I was looking for a C++ plotting library that was extremely easy to use and to add into an existing codebase, preferably header-only. When I found none, I decided to write one myself, which is basically a C++ wrapper around matplotlib. As you can see from the above examples, plotting data and saving it to an image file can be done as few as two lines of code.

The general approach of providing a simple C++ API for utilizing python code was later generalized and extracted into a separate, more powerful library in another project of mine, wrappy.

Todo/Issues/Wishlist

  • This library is not thread safe. Protect all concurrent access with a mutex. Sadly, this is not easy to fix since it is not caused by the library itself but by the python interpreter, which is itself not thread-safe.

  • It would be nice to have a more object-oriented design with a Plot class which would allow multiple independent plots per program.

  • Right now, only a small subset of matplotlibs functionality is exposed. Stuff like xlabel()/ylabel() etc. should be easy to add.

  • If you use Anaconda on Windows, you might need to set PYTHONHOME to Anaconda home directory and QT_QPA_PLATFORM_PLUGIN_PATH to %PYTHONHOME%Library/plugins/platforms. The latter is for especially when you get the error which says 'This application failed to start because it could not find or load the Qt platform plugin "windows" in "".'

  • MacOS: Unable to import matplotlib.pyplot. Cause: In mac os image rendering back end of matplotlib (what-is-a-backend to render using the API of Cocoa by default). There is Qt4Agg and GTKAgg and as a back-end is not the default. Set the back end of macosx that is differ compare with other windows or linux os. Solution is described here, additional information can be found there too(see links in answers).

matplotlib-cpp's People

Contributors

alexdewar avatar atsushisakai avatar baggins800 avatar cdbrkfxrpt avatar chachay avatar charasyn avatar cryoris avatar flyvbee avatar gjacquenot avatar kartikmohta avatar lava avatar liuweijunantihos avatar mandarancio avatar patrikfors avatar pauljurczak avatar pnarvor avatar raldridge11 avatar spiritseeker avatar takoloco avatar tkphd avatar tomix1024 avatar tomotakaeru avatar torfinnberset avatar tustvold avatar valeriomagnago avatar williamleong avatar williamrob104 avatar yoneken avatar yuma-m avatar zinsmatt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

matplotlib-cpp's Issues

Support for Visual Studio 2010

Hi all,

I have been trying to use matplotlib-cpp on Windows with VS 2010 but have not been successful. Is it supported at all? Do you have experiences with that?

Best
Klemens

Issue with VS2017 and Python 3.6

Hey,
I tried using your library but I cant seem to get it working. When I try to run minimal.cpp from VS2017, the console says "ImportError: numpy.core.multiarray failed to import", importing 'numpy.core.multiarray' from the python shell works. When running the program in debug mode, I get an unhandled exception in line 124 of "matplotlibcpp.h" which causes the program to stop.

I appreciate any help

keywords add floating point number

Hello,
I want to change the linewidth of a plot. I tried using this:
std::map<string,string> keywords; keywords["linewidth"]="0.4"; plot(x,y,keywords)

But then I get the error:

gc.set_linewidth(self._linewidth) TypeError: a float is required

Now I wonder how to add keywords that require a floating point number.

Thanks

Error loading module matplotlib.pyplot

Hi,

I have set the PYTHONPATH variable, but get the following error at line 127:

   if (!pymod) { throw std::runtime_error("Error loading module matplotlib.pyplot!"); }

Could you please advice on how to resolve this.

Thanks!

eclipse function

would be brilliant if an Eclipse Function could be implemented!

Supporting Bar

Hi,

Thanks for this library. Its been really helpful thus far.

I've added code that I think should support Bar. I essentially copied all functionality from your support for the plot function and adapted it to bar. The code compiles and runs without issue (it finds the "bar" attribute on the pymod object). When I call:

std::vector y;
y_push_back(0);
y_push_back(1);
y_push_back(2);

plt::bar(y);
plt::show();

A plot appears, however, it is blank. Can you think of a reason, off the top of your head, why bar would not work?

Thanks,
Adam

ImportError: numpy.core.multiarray failed to import

I am trying to use matplotlibcpp with python 3.6, and after a bit of a battle, I managed to get the program to compile. The problem is that now when I run it it, the file starts to run and then it terminates and I get ImportError: numpy.core.multiarray failed to import. I am using numpy 1.15.2. Any suggestions?

Plot from timestamp on c

I m so sorry, but how i can make plot from timestamp using c? I found solutions only for python.

animation speed?

I am trying to animate a large number of points on a scatter plot, but using the pause function for animation (as in the example in examples folder), I can only get it to run so fast. This is how I tried to animate:

vector<int> x(points.size());
vector<int> y(points.size());

plt::show();
vector<int> axis(11);
std::iota(begin(axis), end(axis), -5);
plt::show();
for(size_t i=0; i<points.size(); ++i) {
	x[i] = (int)points[i][0];
	y[i] = (int)points[i][1];
	plt::plot({(double)x[i]}, {(double)y[i]}, ".");
	plt::xticks(axis);
	plt::yticks(axis);
	plt::pause(0.001);
}

but it takes significantly longer than it should, with only about 40 points it takes the animation 10 seconds to finish. I assume this is because at every pause it is drawing the whole thing again? Notice I didn't use plt::clf(). Is there a way to run a faster animation?

/usr/bin/ld: cannot find -lpythonxx

I have tried to compile an example to no avail on Ubuntu with Python 3.7 (Anaconda) running in a VM on Win10.

Code
g++ modern.cpp -I/usr/include/python3.7 -lpython3.7 --std=c++11 -v

I am not able to get rid of the following error
/usr/bin/ld: cannot find -lpython3.7 collect2: error: ld returned 1 exit status

Any support would be greatly appreciated.

Below I have pasted two excerpts from -verbose log (but I cannot see anything wrong except for the error message).

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 ignoring duplicate directory "/usr/include/x86_64-linux-gnu/c++/7" ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu" ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/7/../../../../x86_64-linux-gnu/include" #include "..." search starts here: #include <...> search starts here: /usr/include/python3.7 /usr/include/c++/7 /usr/include/x86_64-linux-gnu/c++/7 /usr/include/c++/7/backward /usr/lib/gcc/x86_64-linux-gnu/7/include /usr/local/include /usr/lib/gcc/x86_64-linux-gnu/7/include-fixed /usr/include/x86_64-linux-gnu /usr/include End of search list.
COLLECT_GCC_OPTIONS='-I' '/usr/include/python3.7' '-std=c++11' '-v' '-shared-libgcc' '-mtune=generic' '-march=x86-64' as -v -I /usr/include/python3.7 --64 -o /tmp/ccfipdIM.o /tmp/cctxAOiD.s GNU assembler version 2.30 (x86_64-linux-gnu) using BFD version (GNU Binutils for Ubuntu) 2.30 COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/7/:/usr/lib/gcc/x86_64-linux-gnu/7/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/7/:/usr/lib/gcc/x86_64-linux-gnu/ LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/7/:/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/7/../../../:/lib/:/usr/lib/ COLLECT_GCC_OPTIONS='-I' '/usr/include/python3.7' '-std=c++11' '-v' '-shared-libgcc' '-mtune=generic' '-march=x86-64' /usr/lib/gcc/x86_64-linux-gnu/7/collect2 -plugin /usr/lib/gcc/x86_64-linux-gnu/7/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/7/lto-wrapper -plugin-opt=-fresolution=/tmp/cco1QpeW.res -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc --sysroot=/ --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie -z now -z relro /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/Scrt1.o /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/7/crtbeginS.o -L/usr/lib/gcc/x86_64-linux-gnu/7 -L/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/7/../../.. /tmp/ccfipdIM.o -lpython3.7 -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib/gcc/x86_64-linux-gnu/7/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/crtn.o
/usr/bin/ld: cannot find -lpython3.7
collect2: error: ld returned 1 exit status

``

Issue with Visual Studio 2013

Hi,

I have an error with the following line during compilation. I have installed Python 3.6 with numpy package.
import_array(); // initialize numpy C-API
Error 1 error C2534: 'matplotlibcpp::detail::_interpreter' : constructor cannot return a value .\matplotlib\matplotlibcpp.h

Could you please help me.
Thanks

Program crashes when I try to run it.

I am running the program in Release mode when I try to run the program it crashes saying "matplotlib.exe" has stopped working. I have just made new project VS2015 imported ur files and set the "Include directories" and "Library directories" path in properties. In Image attached line number is shown where program crashes in matplotlibcpp.h.
untitled

Regards

Can not use with opencv

I was trying to display an image opencv but faild
Error:

treshold.cpp: In function ‘int main(int, char**)’:
treshold.cpp:26:3: error: ‘imshow’ is not a member of ‘plt’
   plt::imshow(originalImage);
   ^
treshold.cpp:26:3: note: suggested alternatives:
In file included from treshold.cpp:7:0:
/usr/local/include/opencv2/highgui.hpp:552:17: note:   ‘cv::imshow’
 CV_EXPORTS void imshow(const String& winname, const ogl::Texture2D& tex);
                 ^
/usr/local/include/opencv2/highgui.hpp:552:17: note:   ‘cv::imshow’

my program:

#include "opencv2/imgproc.hpp"
#include "opencv2/highgui.hpp"
#include "cvplot.h"
#include <stdlib.h>
#include <iostream>
#include "./matplotlibcpp.h"
using namespace cv;
using namespace std;
namespace plt = matplotlibcpp;
int main(int argc, char** argv){
    Mat originalImage, grayImage, treshImage;
    originalImage = imread(argv[1]);
    if(!originalImage.data){
        cout<< "Please give the file name as argument\n";
        cout<< "Format: ./executable filename.ext\n";
    } else{
        cvtColor(originalImage, grayImage, COLOR_BGR2GRAY);
        threshold(grayImage, treshImage, 120, 255, THRESH_BINARY);
        imshow("Original Image", originalImage);
        imshow("Thresholded image", treshImage);
		plt::imshow(originalImage);
		plt::show();
        waitKey(0);
    }
}

Error using dev c++ and python 3.6

Using dev c++ under windows and python 3.6 I get the following error message:
"[Error] returning a value from a constructor"
stemming from the line
#if PY_VERSION_HEX >= 0x03000000
#define NUMPY_IMPORT_ARRAY_RETVAL NULL
in the file "_multiarray_api.h"
Am I doing something wrong here?

A question/request for imshow(), in lieu of an issue.

I don't see any option of how to contact directly, so I hope you don't mind me using this instead.

I love what you're doing with matplotlib here, thank you for developing this as an easy way to plot; all other ways to plot in C++ are horrendous. I was curious if it has the capability of plotting matrices yet, and if not, will it be implemented in the future? I would modify the file myself, but I'm not versed enough in code to do that yet. I'm specifically looking to use matplotlib's function's: figure() & imshow(), in order to plot a matrix as an image (see any picture of Ising Model as an example of what I wish to accomplish). [I also hope to use it as a means to do contour maps in the future, and it would be beneficial also to have matplotlib's 2d quiver() option.]

Thank you for your time.

Crash when I try to open multiple plot windows

First of all, I really enjoy using your matplotlib-cpp wrapper thingy. So thank you for your effort.

I try to show multiple plots in different windows simultaneously. But as soon as I show() a second plot the application crashes.
A colleague of mine said it could be connected to the blocking behavior of the show function (as far as I understood blocking usally means the execution is stopped till the plot window is closed. Maybe this is the case for python, but my C++ code keeps running, so maybe there's the conflict?).
When I close the window first and then open another or the same plot again via show() everything is fine.

I tried to manipulate the code in the header file a bit to pass an optional argument (and I think optional is the critical point) containing ...
block=False
... to the original python matplotlib. But I didn't suceed and it keeps crashing. I tried the following code:

PyObject* args = PyDict_New();
PyDict_SetItemString(args, "block", PyBool_FromLong(0));

PyObject* res = PyObject_CallObject(detail::_interpreter::get().s_python_function_show, args);
if(!res) throw std::runtime_error("Call to show() failed.");

Unfortunately I have no idea what else I could try to pass those optional arguments.

So maybe you can find the problem causing the crashes when opening more than one plot-window, or you can tell me how to pass working optional arguments such as "block"?
Thank you very much in advance!

Regards,
Patrick

No output.[Need Help]

I ran one of the example programs, it compiles without any problems and also runs without an error but I don't see any output or a file that acts as an output.

Plotting a heatmap

Is it possible to plot a heatmap and 3D surface using this framework?

Thanks in advance for your advice!

Couldn't find required function!

I could not get this to output results on Centos 7. I keep getting the "Couldn't find required function error". Can you please tell me why this might be happening? I am running the code as is out of the box.

std::runtime_error when loading matplotlib.pyplot

On osx 10.10.5, the examples build cleanly but when I try to run them I get:
.libc++abi.dylib: terminating with uncaught exception of type std::runtime_error: Error loading module matplotlib.pyplot!
/bAbort trap: 6

I suspect this is a system path issue as I have matplotlib installed on the system:

In [9]: matplotlib.path
Out[9]: ['/Library/Python/2.7/site-packages/matplotlib']

Difficulty making examples work in VS2017

I've been trying to run the examples using cmake + VS2017 but haven't been having much luck, and wondered if it was something I was doing. I have Python and matplotlib installed (in the form of Miniconda) and have been able to compile the examples by changing paths etc. in the generated VS projected. If I copy the right DLLs into the execution folder I can also get the example programs to run, but they terminate prematurely and don't display any output, which is strange.

I was able to get these examples to run on a different machine with VS2017 via the same process, but it doesn't seem to be working for me now for some reason. I just wondered if I'm missing something obvious. Any help would be greatly appreciated!

Issue with VS17

Hi,
i wanted to use this library to plot my data, so i install Python 2.7, numpy and matplotlib, and all of them work well (i write a simple python script to plot some data). When i try to run the minimal example on VS17 (Win10), it gives me an error at row 106:
PyObject* pymod = PyImport_Import(pyplotname);
with this message: "Exception genereted on 0x00007FFA93A7917A (ntdll.dll) in MatPlotLibTest.exe: 0xC0000008: An invalid handle was specified." That is pretty meaningless to me.

To run the file i did following step:

  • Create empty project.
  • Include minimal.cpp
  • Set up include directory for "python.h" and "numpy/arrayobject.h"
  • Set up external libraries for "python27.dll"
  • Substituted #include<Python.h> with
    #ifdef _DEBUG #undef _DEBUG #include <Python.h> #define _DEBUG #else #include <Python.h> #endif
    due to a bug with "python27_d.dll"

Can someone help me?
PS: the script inside contrib directory does not work with VS17.

Can't compile minimal example

terminate called after throwing an instance of 'std::runtime_error'
what(): Error loading module matplotlib!
Aborted (core dumped)

I'm running Arch Linux, have python-matplotlib installed. Compiled with the g++ call shown in the readme, but it doesn't work.

Markersize?

Is there a way to increase the markersize on a plot?
Thank you.

Question: Single file library?

The wrapper is currently only a single .h file, which is great!

However, when more functionality is added (especially functionality to wrap objects returned from matplotlib), I think it would become neccessary to split the wrapper into multiple .h files, and maybe outsource some code into .cpp files. (For example for matplotlib.patches and others)

What is you opinion on that?

Latex typesetting

Where can I add the following lines of Python code to have Latex typesetting on my plots?

plt.rc('text', usetex=True)
plt.rc('font', family='serif')

Thank you.

Hold on possibility

I cannot find the "hold on" functionality. Is it implemented?
I need to plot a 3D graph and in the same plot to put a point like a star.

scatter function

If I wanted to contribute to this project by adding the 'scatter' function, can you provide some advice for getting started?

Plotting on Secondary Y axis

Hello
I am new to matplotlib-cpp and looking to plot data also on Seconday y axis , however i could not find any concrete way of doing it. Could anyone guide me through it please

Non-blocking plot ?

Hi @lava,
For now showing the plot window makes the program wait at line matplotlibcpp::show().
Could it be possible to have another function that creates the window but moves on in the program?

Also a matplotlibcpp::close_all() to close the figures would be great !

Thanks for this great package. It is really convenient :)

Log scale

Is there a way to use logarithmic scale for Y?

How to use with VS2017?

I have been trying to use this for several days without success, I am very lost about the installation steps
my initial try was to use visual package manager and try to get it, I added python and what I imagined was this lib, it worked for simple 2d plot, but most of the real functionality was not there since that was just a very old version of the library.
So I tried to update that package changing the project's matplotlibcpp.h with the code of the library from this tree. It didn-t work, it keep asying that several things are not defined, not all, just some very specific like PyFloat_FromDouble
My second try was to install the latest version of python at my computer and in it install this library, then set the default python nv at VS17 to be that python installation, but once done I am not sure on how to include or use the library I installed since even simple stuff like the
include "Python.h" or include <Python.h> fail

I also tried with the code from the contrib folder at this solution and it never succeed

I would really really appreciate if someone can provide a good step by step documentation of how should I install that library into VS17 c++ as to be able to run the samples that are provided with this solution
Thank you!

Mat image display

How can i display a opencv Mat image using matplotlib library in c++ ?

Suppose I have a Matrix defined by
Mat accumulator_space = Mat::zeros(image.size(), CV_32FC1);
which I fill in with some values after processing it. Now, how can I display it using matplotlib ?

consistent signal 11 during application close

hi,

i am seeing the following crash (consistently) during Py_Finalize. here is the back-trace

 gdb ./basic
GNU gdb (GDB) 7.11.1
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./basic...(no debugging symbols found)...done.
(gdb) run
Starting program: /home/anupam/source-code/c++/matplotlib-cpp.git/examples/basic 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
0x00007fffe94fd1d3 in QApplication::~QApplication() () from /usr/lib/libQtGui.so.4
(gdb) where
#0  0x00007fffe94fd1d3 in QApplication::~QApplication() () from /usr/lib/libQtGui.so.4
#1  0x00007fffea5927a9 in ?? () from /usr/lib/python2.7/site-packages/PyQt4/QtGui.so
#2  0x00007fffea5928ce in ?? () from /usr/lib/python2.7/site-packages/PyQt4/QtGui.so
#3  0x00007fffeb8f4c89 in ?? () from /usr/lib/python2.7/site-packages/sip.so
#4  0x00007fffeb8f62a9 in ?? () from /usr/lib/python2.7/site-packages/sip.so
#5  0x00007ffff7a92c53 in subtype_dealloc () from /usr/lib/libpython2.7.so.1.0
#6  0x00007ffff7a747df in insertdict_by_entry () from /usr/lib/libpython2.7.so.1.0
#7  0x00007ffff7a76330 in dict_set_item_by_hash_or_entry () from /usr/lib/libpython2.7.so.1.0
#8  0x00007ffff7a7b1ec in _PyModule_Clear () from /usr/lib/libpython2.7.so.1.0
#9  0x00007ffff7aeed5d in PyImport_Cleanup () from /usr/lib/libpython2.7.so.1.0
#10 0x00007ffff7afb0fd in Py_Finalize () from /usr/lib/libpython2.7.so.1.0
#11 0x0000000000402201 in matplotlibcpp::detail::_interpreter::~_interpreter() ()
#12 0x00007ffff6de5990 in __run_exit_handlers () from /usr/lib/libc.so.6
#13 0x00007ffff6de59ea in exit () from /usr/lib/libc.so.6
#14 0x00007ffff6dd0298 in __libc_start_main () from /usr/lib/libc.so.6
#15 0x000000000040143a in _start ()
(gdb) 

'basic' here is examples/basic.cpp

here are some environment details:

g++ --version
g++ (GCC) 6.2.1 20160830
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

uname -a
Linux fatcat 4.7.4-1-ARCH #1 SMP PREEMPT Thu Sep 15 15:24:29 CEST 2016 x86_64 GNU/Linux

of course, removing the Py_Finalize from the destructor 'solves' the problem, but that is cheating :)

Cannot compile with makefile

Hello,

Matplotlib-cpp works great when I compile directly with g++ at the command line, but running "make" with a makefile I get the following errors when trying to import. Makefile attached by the way.

Any insights?
Nitin
Makefile.tar.gz

g++ -o main obj/mapmatch.o obj/load_vehicle.o obj/tiremodels.o obj/utils.o obj/simulation.o obj/world.o obj/speed_profiles.o obj/main.o obj/controllers.o
obj/main.o: In function _import_array': main.cpp:(.text+0xe): undefined reference to PyImport_ImportModule'
main.cpp:(.text+0x28): undefined reference to PyExc_ImportError' main.cpp:(.text+0x35): undefined reference to PyErr_SetString'
main.cpp:(.text+0x50): undefined reference to PyObject_GetAttrString' main.cpp:(.text+0x9a): undefined reference to PyExc_AttributeError'
main.cpp:(.text+0xa7): undefined reference to PyErr_SetString' main.cpp:(.text+0xbf): undefined reference to PyCObject_Type'
main.cpp:(.text+0xc8): undefined reference to PyExc_RuntimeError' main.cpp:(.text+0xd5): undefined reference to PyErr_SetString'
main.cpp:(.text+0x123): undefined reference to PyCObject_AsVoidPtr' main.cpp:(.text+0x175): undefined reference to PyExc_RuntimeError'
main.cpp:(.text+0x182): undefined reference to PyErr_SetString' main.cpp:(.text+0x1b9): undefined reference to PyExc_RuntimeError'
main.cpp:(.text+0x1d2): undefined reference to PyErr_Format' main.cpp:(.text+0x213): undefined reference to PyExc_RuntimeError'
main.cpp:(.text+0x22c): undefined reference to PyErr_Format' main.cpp:(.text+0x255): undefined reference to PyExc_RuntimeError'
main.cpp:(.text+0x267): undefined reference to PyErr_Format' main.cpp:(.text+0x27b): undefined reference to PyExc_RuntimeError'
main.cpp:(.text+0x28d): undefined reference to `PyErr_Format'
collect2: error: ld returned 1 exit status
Makefile:14: recipe for target 'main' failed
make: *** [main] Error 1

error in 2nd example

Hi!
When I try to run basic.pp I get
Segmentation fault (core dumped)

I will glad to receive any help.

Compilation Error: Multiple Definition of ...

First off great piece of software, made my life so much easier, so thank you.

However, when I attempted to compile a program with multiple headers, where each header would require access to matplotlibcpp I would receive the compilation error of multiple definitions of plot, stem etc. The solution was to make all the functions inline. Was there a reason why you hadn't made them inline?

I am using CMake to compile everything.

Once again cheers.

Many "undefined reference to" errors w/o plotting

Hi,
Even without plotting, by simply including #include "matplotlibcpp.h" in my main.cpp, I get these compile errors - they also persist when I try to plot:

CMakeFiles/Federschwingung.dir/main.cpp.o: In function matplotlibcpp::annotate(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, double, double)': /home/moritz1/CLionProjects/untitled/matplotlibcpp.h:159: undefined reference to PyTuple_New'
/home/moritz1/CLionProjects/untitled/matplotlibcpp.h:160: undefined reference to PyString_FromString' /home/moritz1/CLionProjects/untitled/matplotlibcpp.h:162: undefined reference to PyFloat_FromDouble'
/home/moritz1/CLionProjects/untitled/matplotlibcpp.h:162: undefined reference to PyTuple_SetItem' /home/moritz1/CLionProjects/untitled/matplotlibcpp.h:163: undefined reference to PyFloat_FromDouble'
/home/moritz1/CLionProjects/untitled/matplotlibcpp.h:163: undefined reference to PyTuple_SetItem' /home/moritz1/CLionProjects/untitled/matplotlibcpp.h:165: undefined reference to PyDict_New'
/home/moritz1/CLionProjects/untitled/matplotlibcpp.h:166: undefined reference to PyDict_SetItemString' /home/moritz1/CLionProjects/untitled/matplotlibcpp.h:168: undefined reference to PyTuple_New'
/home/moritz1/CLionProjects/untitled/matplotlibcpp.h:169: undefined reference to PyTuple_SetItem' /home/moritz1/CLionProjects/untitled/matplotlibcpp.h:171: undefined reference to PyObject_Call'
CMakeFiles/Federschwingung.dir/main.cpp.o: In function matplotlibcpp::detail::_interpreter::_interpreter()': /home/moritz1/CLionProjects/untitled/matplotlibcpp.h:72: undefined reference to Py_SetProgramName'
/home/moritz1/CLionProjects/untitled/matplotlibcpp.h:73: undefined reference to Py_Initialize' /home/moritz1/CLionProjects/untitled/matplotlibcpp.h:75: undefined reference to PyString_FromString'
/home/moritz1/CLionProjects/untitled/matplotlibcpp.h:76: undefined reference to PyString_FromString' /home/moritz1/CLionProjects/untitled/matplotlibcpp.h:79: undefined reference to PyImport_Import'
/home/moritz1/CLionProjects/untitled/matplotlibcpp.h:83: undefined reference to PyImport_Import' /home/moritz1/CLionProjects/untitled/matplotlibcpp.h:87: undefined reference to PyObject_GetAttrString'
/home/moritz1/CLionProjects/untitled/matplotlibcpp.h:88: undefined reference to PyObject_GetAttrString' /home/moritz1/CLionProjects/untitled/matplotlibcpp.h:89: undefined reference to PyObject_GetAttrString'
/home/moritz1/CLionProjects/untitled/matplotlibcpp.h:90: undefined reference to PyObject_GetAttrString' /home/moritz1/CLionProjects/untitled/matplotlibcpp.h:91: undefined reference to PyObject_GetAttrString'
CMakeFiles/Federschwingung.dir/main.cpp.o:/home/moritz1/CLionProjects/untitled/matplotlibcpp.h:92: more undefined references to PyObject_GetAttrString' follow CMakeFiles/Federschwingung.dir/main.cpp.o: In function matplotlibcpp::detail::_interpreter::_interpreter()':
/home/moritz1/CLionProjects/untitled/matplotlibcpp.h:128: undefined reference to PyFunction_Type' /home/moritz1/CLionProjects/untitled/matplotlibcpp.h:129: undefined reference to PyFunction_Type'
/home/moritz1/CLionProjects/untitled/matplotlibcpp.h:130: undefined reference to PyFunction_Type' /home/moritz1/CLionProjects/untitled/matplotlibcpp.h:131: undefined reference to PyFunction_Type'
/home/moritz1/CLionProjects/untitled/matplotlibcpp.h:132: undefined reference to PyFunction_Type' CMakeFiles/Federschwingung.dir/main.cpp.o:/home/moritz1/CLionProjects/untitled/matplotlibcpp.h:133: more undefined references to PyFunction_Type' follow
CMakeFiles/Federschwingung.dir/main.cpp.o: In function matplotlibcpp::detail::_interpreter::_interpreter()': /home/moritz1/CLionProjects/untitled/matplotlibcpp.h:148: undefined reference to PyTuple_New'
CMakeFiles/Federschwingung.dir/main.cpp.o: In function matplotlibcpp::detail::_interpreter::~_interpreter()': /home/moritz1/CLionProjects/untitled/matplotlibcpp.h:152: undefined reference to Py_Finalize'
CMakeFiles/Federschwingung.dir/main.cpp.o: In function matplotlibcpp::legend()': /home/moritz1/CLionProjects/untitled/matplotlibcpp.h:450: undefined reference to PyObject_CallObject'
CMakeFiles/Federschwingung.dir/main.cpp.o: In function matplotlibcpp::show()': /home/moritz1/CLionProjects/untitled/matplotlibcpp.h:606: undefined reference to PyObject_CallObject'
CMakeFiles/Federschwingung.dir/main.cpp.o: In function bool matplotlibcpp::plot<double, double>(std::vector<double, std::allocator<double> > const&, std::vector<double, std::allocator<double> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)': /home/moritz1/CLionProjects/untitled/matplotlibcpp.h:315: undefined reference to PyList_New'
/home/moritz1/CLionProjects/untitled/matplotlibcpp.h:316: undefined reference to PyList_New' /home/moritz1/CLionProjects/untitled/matplotlibcpp.h:317: undefined reference to PyString_FromString'
/home/moritz1/CLionProjects/untitled/matplotlibcpp.h:320: undefined reference to PyFloat_FromDouble' /home/moritz1/CLionProjects/untitled/matplotlibcpp.h:320: undefined reference to PyList_SetItem'
/home/moritz1/CLionProjects/untitled/matplotlibcpp.h:321: undefined reference to PyFloat_FromDouble' /home/moritz1/CLionProjects/untitled/matplotlibcpp.h:321: undefined reference to PyList_SetItem'
/home/moritz1/CLionProjects/untitled/matplotlibcpp.h:324: undefined reference to PyTuple_New' /home/moritz1/CLionProjects/untitled/matplotlibcpp.h:325: undefined reference to PyTuple_SetItem'
/home/moritz1/CLionProjects/untitled/matplotlibcpp.h:326: undefined reference to PyTuple_SetItem' /home/moritz1/CLionProjects/untitled/matplotlibcpp.h:327: undefined reference to PyTuple_SetItem'
/home/moritz1/CLionProjects/untitled/matplotlibcpp.h:329: undefined reference to PyObject_CallObject' CMakeFiles/Federschwingung.dir/main.cpp.o: In function bool matplotlibcpp::plot(std::vector<double, std::allocator > const&, std::vector<double, std::allocator > const&, std::map<std::__cxx11::basic_string<char, std::char_traits, std::allocator >, std::__cxx11::basic_string<char, std::char_traits, std::allocator >, std::less<std::__cxx11::basic_string<char, std::char_traits, std::allocator > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits, std::allocator > const, std::__cxx11::basic_string<char, std::char_traits, std::allocator > > > > const&)':
/home/moritz1/CLionProjects/untitled/matplotlibcpp.h:187: undefined reference to PyList_New' /home/moritz1/CLionProjects/untitled/matplotlibcpp.h:188: undefined reference to PyList_New'
/home/moritz1/CLionProjects/untitled/matplotlibcpp.h:191: undefined reference to PyFloat_FromDouble' /home/moritz1/CLionProjects/untitled/matplotlibcpp.h:191: undefined reference to PyList_SetItem'
/home/moritz1/CLionProjects/untitled/matplotlibcpp.h:192: undefined reference to PyFloat_FromDouble' /home/moritz1/CLionProjects/untitled/matplotlibcpp.h:192: undefined reference to PyList_SetItem'
/home/moritz1/CLionProjects/untitled/matplotlibcpp.h:196: undefined reference to PyTuple_New' /home/moritz1/CLionProjects/untitled/matplotlibcpp.h:197: undefined reference to PyTuple_SetItem'
/home/moritz1/CLionProjects/untitled/matplotlibcpp.h:198: undefined reference to PyTuple_SetItem' /home/moritz1/CLionProjects/untitled/matplotlibcpp.h:201: undefined reference to PyDict_New'
/home/moritz1/CLionProjects/untitled/matplotlibcpp.h:204: undefined reference to PyString_FromString' /home/moritz1/CLionProjects/untitled/matplotlibcpp.h:204: undefined reference to PyDict_SetItemString'
/home/moritz1/CLionProjects/untitled/matplotlibcpp.h:207: undefined reference to PyObject_Call' CMakeFiles/Federschwingung.dir/main.cpp.o: In function bool matplotlibcpp::named_plot(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&, std::vector<double, std::allocator > const&, std::vector<double, std::allocator > const&, std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&)':
/home/moritz1/CLionProjects/untitled/matplotlibcpp.h:406: undefined reference to PyDict_New' /home/moritz1/CLionProjects/untitled/matplotlibcpp.h:407: undefined reference to PyString_FromString'
/home/moritz1/CLionProjects/untitled/matplotlibcpp.h:407: undefined reference to PyDict_SetItemString' /home/moritz1/CLionProjects/untitled/matplotlibcpp.h:409: undefined reference to PyList_New'
/home/moritz1/CLionProjects/untitled/matplotlibcpp.h:410: undefined reference to PyList_New' /home/moritz1/CLionProjects/untitled/matplotlibcpp.h:411: undefined reference to PyString_FromString'
/home/moritz1/CLionProjects/untitled/matplotlibcpp.h:414: undefined reference to PyFloat_FromDouble' /home/moritz1/CLionProjects/untitled/matplotlibcpp.h:414: undefined reference to PyList_SetItem'
/home/moritz1/CLionProjects/untitled/matplotlibcpp.h:415: undefined reference to PyFloat_FromDouble' /home/moritz1/CLionProjects/untitled/matplotlibcpp.h:415: undefined reference to PyList_SetItem'
/home/moritz1/CLionProjects/untitled/matplotlibcpp.h:418: undefined reference to PyTuple_New' /home/moritz1/CLionProjects/untitled/matplotlibcpp.h:419: undefined reference to PyTuple_SetItem'
/home/moritz1/CLionProjects/untitled/matplotlibcpp.h:420: undefined reference to PyTuple_SetItem' /home/moritz1/CLionProjects/untitled/matplotlibcpp.h:421: undefined reference to PyTuple_SetItem'
/home/moritz1/CLionProjects/untitled/matplotlibcpp.h:423: undefined reference to PyObject_Call' CMakeFiles/Federschwingung.dir/main.cpp.o: In function void matplotlibcpp::xlim(int, int)':
/home/moritz1/CLionProjects/untitled/matplotlibcpp.h:476: undefined reference to PyList_New' /home/moritz1/CLionProjects/untitled/matplotlibcpp.h:477: undefined reference to PyFloat_FromDouble'
/home/moritz1/CLionProjects/untitled/matplotlibcpp.h:477: undefined reference to PyList_SetItem' /home/moritz1/CLionProjects/untitled/matplotlibcpp.h:478: undefined reference to PyFloat_FromDouble'
/home/moritz1/CLionProjects/untitled/matplotlibcpp.h:478: undefined reference to PyList_SetItem' /home/moritz1/CLionProjects/untitled/matplotlibcpp.h:480: undefined reference to PyTuple_New'
/home/moritz1/CLionProjects/untitled/matplotlibcpp.h:481: undefined reference to PyTuple_SetItem' /home/moritz1/CLionProjects/untitled/matplotlibcpp.h:483: undefined reference to PyObject_CallObject'
collect2: error: ld returned 1 exit status
CMakeFiles/Federschwingung.dir/build.make:94: recipe for target 'Federschwingung' failed
make[3]: *** [Federschwingung] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/Federschwingung.dir/all' failed
make[2]: *** [CMakeFiles/Federschwingung.dir/all] Error 2
CMakeFiles/Makefile2:79: recipe for target 'CMakeFiles/Federschwingung.dir/rule' failed
make[1]: *** [CMakeFiles/Federschwingung.dir/rule] Error 2
Makefile:118: recipe for target 'Federschwingung' failed
make: *** [Federschwingung] Error 2

I'm sure my path to python2.7 or my CMakeLists.txt is wrong, but I followed your instructions for python with sudo aptitude install python-matplotlib python-numpy python2.7-dev and sudo aptitude install libpython2.7. This is my CMakeLists.txt :

`CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
project(Federschwingung)

ADD_DEFINITIONS(-std=gnu++11)

ADD_EXECUTABLE(Federschwingung main.cpp matplotlibcpp.h)`

I'm using Ubuntu 16.04 LTS.
I first cloned today, after the push at 2017-04-29 17:15:47.

tweaking plot_surface for 3D scatter plot

I tried to tweak a copy of the edit in "plot_surface" function in 69e58fe to make scatter work for 3D scatter plots. I almost got it to work, except that the X and Y coordinates of the points are right, but the Z is always zero. I am not very experienced in Python (or C++ for that matter). Any help will be appreciated.

3D plot

Does it support 3D plots ?

fail to run, cannot find python36.dll

Hi.

Thank you for your eminent work.

I am truing to get matplotlib-cpp to work.

I have a laptop with Win1o 64
VS 2017 and anaconda3 64

I had to do some changes to get tke config to run.

set batch_file=C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\Tools....\VC\Auxiliary\Build\vcvarsall.bat

then
CMake Warning:
Manually-specified variables were not used by the project:

CMAKE_BUILD_TYPE
PYTHONHOME

are these important?

at the end:
The syntax of the command is incorrect.

looks like it is this:
if EXIST %PYTHONHOME%/Library/plugins/platforms/qwindows.dll ^
copy %PYTHONHOME%/Library/plugins/platforms/qwindows.dll ./platforms/

NB! windows.dll do exist

I had to set: #define WITHOUT_NUMPY
is there a fix for this?

The project compiles and produces 4 exe files.

When I try to run them I get:

... failed due to python36.dll not found!

Could you please give me a hint how this can be fixed?

Regards

Jan Didrik

[email protected]
[email protected]

Cannot compile with Python3.6 using simple example

I am trying to compile the simple modern.cpp example listed on the front page, but receive the following error:

$ g++ modern.cpp -I/usr/include/python3.6 -lpython3.6 --std=c++11

In file included from modern.cpp:2:0:
matplotlibcpp.h: In function 'void matplotlibcpp::plot_surface(const std::vector<std::vector<Numeric> >&, const std::vector<std::vector<Numeric> >&, const std::vector<std::vector<Numeric> >&, const std::map<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> >&)':
matplotlibcpp.h:445:43: error: there are no arguments to 'PyInt_FromLong' that depend on a template parameter, so a declaration of 'PyInt_FromLong' must be available [-fpermissive]
   PyDict_SetItemString(kwargs, "rstride", PyInt_FromLong(1));
                                           ^~~~~~~~~~~~~~
matplotlibcpp.h:445:43: note: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated)
matplotlibcpp.h:446:43: error: there are no arguments to 'PyInt_FromLong' that depend on a template parameter, so a declaration of 'PyInt_FromLong' must be available [-fpermissive]
   PyDict_SetItemString(kwargs, "cstride", PyInt_FromLong(1));

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.