EMT – Using Gnuplot

The following functions (or similar code) will be added to the next version of EMT.

>function mxmsetpng (w=1000,h=1000) ...
$ term="pngcairo size "+w+","+h;
$ mxm(''set_plot_option([gnuplot_term,"''+term+''"]);'');
$ file=strrepl(eulerhome()+"gnuout.png","\","/");
$ mxm(''set_plot_option([gnuplot_out_file,"''+file+''"])'');
$ gnufile$$=eulerhome()+"gnuout.png";
>function mxmins (lines=32) ...
$ loadimg(lines,gnufile$$);

With that you can let Gnu Plot produce a PNG, which can be loaded into a notebook.

>r &= (exp(cos(t))-2*cos(4*t)-sin(t/12)^5); ...
>&plot2d([parametric, r*sin(t), r*cos(t),  ...
>   [t, -8*%pi, 8*%pi], [nticks, 2000]]);


The same plot with Euler looks like this.

>plot2d(&"r*sin(t) with t=x",&"r*cos(t) with t=x",xmin=-8pi,xmax=8pi, ...
>  n=1000,color=blue):


Update: I changed „png“ to „pngcairo“, which produces a nicer image.

Update: For the next, version, the following will be possible.


This inserts the output of Gnu Plot automatically. It is still possible to use mxmpng() before this call. This will be necessary for other aspect ratios than 1:1.



The closest you can get in EMT to this is the following.

>gridstyle(".",".",black,black,black); aspect(3/2); margin(0); ...


Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht.

Diese Website verwendet Akismet, um Spam zu reduzieren. Erfahre mehr darüber, wie deine Kommentardaten verarbeitet werden.