www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Plot library wanted

reply "terchestor" <terchestor gmail.com> writes:
I need a rather simple but efficient 2D (but 3D would be even 
better) plotting library for DSP visualization.
PLplot has D language bindings, however a search for PLplot on 
this site pages returns only three old links.
Does anyone using PLplot can tell if it's worth using it or is 
there any alternative?
Jan 27 2014
next sibling parent reply "John Colvin" <john.loughran.colvin gmail.com> writes:
On Monday, 27 January 2014 at 12:46:43 UTC, terchestor wrote:
 I need a rather simple but efficient 2D (but 3D would be even 
 better) plotting library for DSP visualization.
 PLplot has D language bindings, however a search for PLplot on 
 this site pages returns only three old links.
 Does anyone using PLplot can tell if it's worth using it or is 
 there any alternative?
Don't know about PLplot but you could take a look at https://github.com/dsimcha/Plot2kill
Jan 27 2014
parent Jordi Sayol <g.sayol yahoo.es> writes:
El 27/01/14 13:54, John Colvin ha escrit:
 On Monday, 27 January 2014 at 12:46:43 UTC, terchestor wrote:
 I need a rather simple but efficient 2D (but 3D would be even better) plotting
library for DSP visualization.
 PLplot has D language bindings, however a search for PLplot on this site pages
returns only three old links.
 Does anyone using PLplot can tell if it's worth using it or is there any
alternative?
Don't know about PLplot but you could take a look at https://github.com/dsimcha/Plot2kill
If in Debian, there are plot2kill binary packages: http://d-apt.sourceforge.net/ $ sudo apt-get install libplot2kill-dev libplot2kill-doc There is an example: $ dmd `pkg-config --cflags --libs plot2kill-static` -run /usr/share/libplot2kill-doc/examples/demo.d -- Jordi Sayol
Jan 27 2014
prev sibling parent reply "dan" <dan.hitt gmail.com> writes:
On Monday, 27 January 2014 at 12:46:43 UTC, terchestor wrote:
 ((snipped))
 Does anyone using PLplot can tell if it's worth using it or is 
 there any alternative?
Well, this thread is a 1.5 years old but i was looking around for info on plplot also, and it is possible to use it with d, at least on ubuntu 15.04. Nevertheless, David's package that John and Jordi referred to should also be investigated. But just in case somebody else is searching for how to use plplot with d, this is how you can do it on ubuntu 15.04, assuming you already have gcd installed: (1) get the package: sudo apt-get install libplplot-d libplplot-dev plplot-doc (2) copy one of the d demo programs from http://plplot.sourceforge.net/examples.php (I did the first one, so i know it works at least for one.) To get to the source code, you click on the picture and then choose 'D'. I named the copied file for the first demo 'irwin_line_demo.d' (3) write a makefile along these lines: irwin_line_demo : irwin_line_demo.o gdc -o $ $^ -lplplotdmdd -lplplotd irwin_line_demo.o : irwin_line_demo.d gdc -c -Wall $^ -I/usr/include/plplot No doubt this might be simplified and made more systematic using pkg-config or other tools, and absolutely David's plot2kill should be considered before settling on a solution.
Sep 05 2015
parent "Laeeth Isharc" <spamnolaeeth nospamlaeeth.com> writes:
On Saturday, 5 September 2015 at 19:38:46 UTC, dan wrote:
 On Monday, 27 January 2014 at 12:46:43 UTC, terchestor wrote:
 ((snipped))
 Does anyone using PLplot can tell if it's worth using it or is 
 there any alternative?
Well, this thread is a 1.5 years old but i was looking around for info on plplot also, and it is possible to use it with d, at least on ubuntu 15.04. Nevertheless, David's package that John and Jordi referred to should also be investigated.
In case of interest, mathgl works well for some uses, and I have D bindings (wrapper in process). http://mathgl.sourceforge.net/doc_en/Main.html https://github.com/Laeeth/dmathgl import mgl; int main() { HMGL gr = mgl_create_graph(600,400); if (gr is null) { writefln("cannot create graph"); return 0; } writefln("graph created"); mgl_fplot(gr,"sin(pi*x)","",""); writefln("sin plotted"); sample(gr); mgl_write_frame(gr,"test.png",""); writefln("frame written"); mgl_delete_graph(gr); writefln("graph deleted"); return 0; } int sample(HMGL gr) { auto o=mgl_create_data_size(10,1,1); auto h=mgl_create_data_size(10,1,1); auto l=mgl_create_data_size(10,1,1); auto c=mgl_create_data_size(10,1,1); mgl_data_fill_eq(gr,o,"0.5*sin(pi*x)".toStringz,null,null,null); mgl_data_fill_eq(gr,c,"0.5*sin(pi*(x+2/9))".toStringz,null,null,null); mgl_data_fill_eq(gr,l,"0.3*rnd-0.8".toStringz,null,null,null); mgl_data_fill_eq(gr,h,"0.3*rnd+0.5".toStringz,null,null,null); mgl_subplot(gr,1,1,0,""); mgl_title(gr,"OHLC plot".toStringz,"".toStringz,1.0); mgl_box(gr); mgl_ohlc(gr,o,h,l,c,"".toStringz,"".toStringz); mgl_puts(gr,0.5,0.5,1.0,"hello".toStringz,"rC".toStringz,10.0); return 0; }
Sep 05 2015