Replies: 5 comments 9 replies
-
You can tell Gnuplot not to open a window. The error you're getting is from the Qt terminal, so you should be fine. To not open the window, create the figure in quiet mode: auto f = figure(true); plot whatever you want, and then save: f->save("image_name.svg"); If you really need to avoid Gnuplot, even in this non-interactive mode, then the only solution would be to write a completely non-interactive backend for images. Probably something like AGG for vector graphics. It's also possible to adapt the OpenGL backend to save its buffer as JPG or even SVG, but I think it probably doesn't adapt well to your use case. I don't have a lot of experience with OpenGL. I know you can save the buffer but I don't if it's possible to completely bypass the interactive graphics like that. See this section |
Beta Was this translation helpful? Give feedback.
-
Another option is to permanently set the output in the backend: auto f = figure(true);
f->backend()->output("file.svg"); Now, whenever you call: f->draw(); it will save an image in |
Beta Was this translation helpful? Give feedback.
-
Great!! Thank you. Setting figure(true) is exactly what I want. Now I can call the executable file on a Jupiter notebook server for data science tasks easily. The option OpenGL backend attracts me as well because my original interest with matplot++ is scientific applications on iOS devices. Currently I use Core-plot for iOS graphs but matplotlib is much less verbose for scientific applications. matplotlib-cpp needs python so it is not a choice in iOS. Gnuplot seems not to work on iOS as well but there is OpenGL ES on iPhone. I am not sure does it work but if it did, matplot++ will be a great tool to push a lot scientific applications into practical use on phones. |
Beta Was this translation helpful? Give feedback.
-
I'm glad it could solve your problem. A Jupiter notebook seems interesting. Let me know if there's anything public in that sense. Yes. You can also use OpenGL in Qt applications, embed it in an ImGui style, or compile it to WebGL with Emscripten. I'm slowly implementing this backend as I need its plots for other applications. Line plots are fine. The others might take a while. |
Beta Was this translation helpful? Give feedback.
-
what does matplot++ bring comparing to directly use gnuplot with c++? |
Beta Was this translation helpful? Give feedback.
-
I am interested on using Matplot++ to generate plot and save them as images on server.
The code runs well and generate the image as I want. However, every time running matplot++, it tries to open the gnuplot and fail, which generates the error message:
Is there anyway to tell matplot++ do not open the gnu plot? It will make the library a perfect choice for many data science tasks.
Beta Was this translation helpful? Give feedback.
All reactions