GNUPlotCPP - a tool for creating function plots from C++ code

DSP, Plugin and Host development discussion.
RELATED
PRODUCTS

Post

Spyder is half way there, you still need to explicitely write cqlls to do the plots.

For me, Matlab and Octave are different beasts.Close one, almost twins, but Octave is the crippled one. So code for Matlab doesn't always work with Octave (not even talking about toolboxes!). Lots of universities and even companies are switching to Python for cost and flexibility reasons. I wouldn't try to code a complex algorithm in Matlab (because it's only a half baked language, not a real one, actually), but in Python, I would because I can design it efficiently to reuse it or part of it in another code.

Post

Miles1981 wrote:Spyder is half way there, you still need to explicitely write cqlls to do the plots.

For me, Matlab and Octave are different beasts.Close one, almost twins, but Octave is the crippled one. So code for Matlab doesn't always work with Octave (not even talking about toolboxes!). Lots of universities and even companies are switching to Python for cost and flexibility reasons. I wouldn't try to code a complex algorithm in Matlab (because it's only a half baked language, not a real one, actually), but in Python, I would because I can design it efficiently to reuse it or part of it in another code.
aha - interesting to hear that academia is shifting to python as well. at my time at university, matlab was the de facto standard. i may have a look into spyder. thanks for the information!
My website: rs-met.com, My presences on: YouTube, GitHub, Facebook

Post

I am using MinGW btw.. and codeblocks but I'd rather not depend on a codeblocks project file. I will give it a spin and see if I encounter any problems.

Post

Music Engineer wrote:aha - interesting to hear that academia is shifting to python as well. at my time at university, matlab was the de facto standard. i may have a look into spyder. thanks for the information!
I guess Matlab is still the standard, just as Fortran is still taught because the teachers are used to it. But it shifts :)

Post

Miles1981 wrote:
Music Engineer wrote:aha - interesting to hear that academia is shifting to python as well. at my time at university, matlab was the de facto standard. i may have a look into spyder. thanks for the information!
I guess Matlab is still the standard, just as Fortran is still taught because the teachers are used to it. But it shifts :)
nice. i think it's a good move of academic institutions to move to free and open-source tools. i generally think that educational material and tools (as well as scientific research papers - "knowledge" in general) should be freely available, in particular, if the research was publicly funded. i'm a big proponent of the open access philosophy. well - that python thing looks very nice indeed. could you recommend some tutorials/ebooks to get started (preferably in pdf format)? and then, for later, maybe also more advanced material - must-read reference literature and stuff?
My website: rs-met.com, My presences on: YouTube, GitHub, Facebook

Post

Well, I know of some books I reviewed on my blog, from introductory Numpy stuff to more advanced stuff with machine learning.
The scikits.learn doc is filled with tutorials, for the basics, I would go and look at Scipy's doc!

And +1 with everything you said.

Post

+1 for the Numpy /Scipy stack + scikits.audiolab

Sympy is great too, it's not on par with Mathematica, Mapple or Maxima, but it's getting closer every day.

It's been a few years now since I last wrote a line of Matlab code.

Post

Maybe an api for rendering / saving plots to image files - or did I miss something?

Post

Mayae wrote:Maybe an api for rendering / saving plots to image files - or did I miss something?
i'm not sure - is this a feature request? if you want to save your plots to files, you can do this from the GNUPlot GUI application (the 2nd button from the left). it supports file export to .png, .svg and .pdf. the pdf files in the folder Documentation/Plots (which are used in the LaTex file for the user manual) where created this way
My website: rs-met.com, My presences on: YouTube, GitHub, Facebook

Post

Music Engineer wrote:
Mayae wrote:Maybe an api for rendering / saving plots to image files - or did I miss something?
i'm not sure - is this a feature request? if you want to save your plots to files, you can do this from the GNUPlot GUI application (the 2nd button from the left). it supports file export to .png, .svg and .pdf. the pdf files in the folder Documentation/Plots (which are used in the LaTex file for the user manual) where created this way
I guess, if it's possible? Yes you can do it in the application, but batch exporting data sets (or anything else in quantities) gets cumbersome then..

Post

is this a common use case - to batch-export plots? i actually always prepare one plot at a time - for later inclusion in documents. maybe i could provide an exportPlot(string format, string path) function that, instead of opening a plot window, writes the plot into a file and otherwise works the same as the plot/plot3D functions. i think, the GNUPlot commandline interface provides commands for redirecting the plot into a file. i would just have to add the appropriate commands to the commandfile. i think, this is what i would need:

http://www.gnuplotting.org/output-terminals/

this exportPlot function could then be called in a loop.
My website: rs-met.com, My presences on: YouTube, GitHub, Facebook

Post

Yeah that seems to be the ticket. To me it seems very useful, maybe just me, I don't know.

Post

meanwhile, i have moved the code to my github. here are a few demo plots (the ones that are created in Demos.h/cpp):

https://github.com/RobinSchmidt/GNUPlotCPP/issues/3

it can now also do vector fields and i even added a (simple!) ODE solver (as an optional add-on file) to be able to plot field-lines. here is an example:

Image

i have no idea, if that is of any use for audio stuff, but i thought, it's a cool feature. ...and equipotentials...but plotting these really requires some problem knowledge at the client code side at the moment. in this plot:

Image

i use the analytic expressions for the electric field and draw the field-lines by numerically solving the resulting ODE system. the equipotentials are drawn by using a numerical root finder (bisection). ...ideally, i'd like to automate all of that and just let client code pass a bivariate potential function and the rest (plotting field-lines and equipotentials) would be done automatically (i'd have to compute the gradient of the potential (i.e. the direction of the vector-field) numerically - that would be two levels of numeric approximation :o ) - maybe someday...
My website: rs-met.com, My presences on: YouTube, GitHub, Facebook

Post

We now have (optional) dark mode 8) and we can do pretty contour maps!


ContourMap_ViridisBrt.png
ContourMap_Magma.png
We can also select a color map. Shown above is some variation of "viridis" that I found somewhere on the internet:

https://stackoverflow.com/questions/358 ... tour-lines

It's overall brighter than the viridis map, with some more orange-ish tones towards the top. Maybe it's closer to "parula". The other one is "magma" taken from here:

https://github.com/Gnuplotting/gnuplot-palettes

There are so many more and I still have to do some grunt work to include more of these color palettes. I'll probably won't include all of them - they are too many and some of them are ugly. But if anyone knows good sources for well designed and beautiful color maps, bring it on so I may include them as well. Designing a good color map is half art, half science.
You do not have the required permissions to view the files attached to this post.
My website: rs-met.com, My presences on: YouTube, GitHub, Facebook

Post

Probably offtopic, but I've been using ImGui+ImPlot for interactive visualisation.

Gnuplot is nice for publications and stuff, but when it comes to tweaking things in realtime and seeing the results immediately within the c++ code, gnuplot doesn't work as nice.

Post Reply

Return to “DSP and Plugin Development”