GNUPlotCPP - a tool for creating function plots from C++ code
-
- KVRian
- 1379 posts since 26 Apr, 2004 from UK
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.
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.
-
Music Engineer Music Engineer https://www.kvraudio.com/forum/memberlist.php?mode=viewprofile&u=15959
- KVRAF
- Topic Starter
- 4283 posts since 8 Mar, 2004 from Berlin, Germany
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!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.
-
- KVRian
- 1379 posts since 26 Apr, 2004 from UK
I guess Matlab is still the standard, just as Fortran is still taught because the teachers are used to it. But it shiftsMusic 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!
-
Music Engineer Music Engineer https://www.kvraudio.com/forum/memberlist.php?mode=viewprofile&u=15959
- KVRAF
- Topic Starter
- 4283 posts since 8 Mar, 2004 from Berlin, Germany
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?Miles1981 wrote:I guess Matlab is still the standard, just as Fortran is still taught because the teachers are used to it. But it shiftsMusic 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!
-
- KVRian
- 1379 posts since 26 Apr, 2004 from UK
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.
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.
-
- KVRian
- 626 posts since 29 Jul, 2003 from Paris - France
+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.
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.
-
- KVRian
- 573 posts since 1 Jan, 2013 from Denmark
Maybe an api for rendering / saving plots to image files - or did I miss something?
-
Music Engineer Music Engineer https://www.kvraudio.com/forum/memberlist.php?mode=viewprofile&u=15959
- KVRAF
- Topic Starter
- 4283 posts since 8 Mar, 2004 from Berlin, Germany
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 wayMayae wrote:Maybe an api for rendering / saving plots to image files - or did I miss something?
-
- KVRian
- 573 posts since 1 Jan, 2013 from Denmark
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..Music Engineer wrote: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 wayMayae wrote:Maybe an api for rendering / saving plots to image files - or did I miss something?
-
Music Engineer Music Engineer https://www.kvraudio.com/forum/memberlist.php?mode=viewprofile&u=15959
- KVRAF
- Topic Starter
- 4283 posts since 8 Mar, 2004 from Berlin, Germany
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.
http://www.gnuplotting.org/output-terminals/
this exportPlot function could then be called in a loop.
-
- KVRian
- 573 posts since 1 Jan, 2013 from Denmark
Yeah that seems to be the ticket. To me it seems very useful, maybe just me, I don't know.
-
Music Engineer Music Engineer https://www.kvraudio.com/forum/memberlist.php?mode=viewprofile&u=15959
- KVRAF
- Topic Starter
- 4283 posts since 8 Mar, 2004 from Berlin, Germany
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:
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:
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 ) - maybe someday...
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:
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:
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 ) - maybe someday...
-
Music Engineer Music Engineer https://www.kvraudio.com/forum/memberlist.php?mode=viewprofile&u=15959
- KVRAF
- Topic Starter
- 4283 posts since 8 Mar, 2004 from Berlin, Germany
We now have (optional) dark mode and we can do pretty contour maps!
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.
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.
-
- KVRian
- 631 posts since 21 Jun, 2013
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.
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.