gnuplot.exe from commandline - starting interactive 3D plot directly? - gnuplot

I use Gnuplot to plot graphes in my application, I write a command file, call it and then just copy the .png generated.
But now I need to show 3D plots, and they are quite useless if one can not "look around" using the mouse.
So I would like to start wgnuplot.exe and tell it to immediately execute a command (splot "data.dat" with pm3d), so it generates a new window with the interactive 3d plot.
Is this possible? If so, how? When I try it, all I get is a image of the plot, but nothing interactive.
Thanks in advance!

Answer:
1.) add "save 'x.plt'" to the plotting command script
2.) call wgnuplot.exe -e "load 'x.plt'"

Related

how to save two plots simultaneously in gnuplot

Hiii...
I havebeen trying to plot two curves simultaneously in a single plot to compare them. ie, by the command:
plot "1.txt" w l, "2.txt" w l
now I want to save it, but the usual command for saving is:
set out "1.txt"
but in this case how can I save them together in a same plot?
For saving a plot as a file on your disk, you need to setup two things: a terminal and an output. Suppose you have configured your plot interactively in a command-line gnuplot session, this is an example:
set terminal png
set output "myplot.png"
replot
unset output
where replot does what its command name suggests, it repeats the last plot command - and if that last plot command showed both curves as you wanted it, they will identically show up in the output file. For info on supported terminal types on your system, read help terminal.

gnuplot graphs disappear after zoom

I run gnuplot with the following command
plot for [i=1:2] "+" using (10*$1):($1**i) with lines
Two graphs appear. If I then zoom in both graphs suddenly disappear (at a certain zoom level). This is annoying.
Of course, I do not zoom into an empty region ;-)
Does someone know how to fix that?
PS: I use the standard output terminal under linux.

Gnuplot script disappear after creation

I have a gnuplot script. My system is ubuntu 14.04. When In the terminal I type gnuplot myPlot. The plot will disappear. It is not remain on the screen. I this stack in saw similar question. But its system is windows. I want to know is there any solution for that on ubuntu 14.04 32 bit
PS: when I use gnuplot>-- I mean when I do not use script file-- I see the diagram and it does not disappear.
PS2 : this is my simple gnuplot script file :
set boxwidth 0.5
set style fill solid
plot "dataFile" using 1:2:xtic(2) with boxes
If you want the plotting window to remain open, you must call gnuplot with the -persist flag:
gnuplot -persist myPlot
There are already nice answers here, but the -persist flag did not work for me and enabling x11 force GnuPlot to use crapy XQuarts for windowing instead of beloved Qt. What worked for me was the
pause -1
command (from here) at the end of the script. According to the documentation
pause -1 # Wait until a carriage return is hit
I hope it helps.
If you do not want to call gnuplot with the extra argument (-persist), you can enable this functionality within your script, e.g.
set term x11 persist

Gnuplot: is there a way to add small gif icon on the plot?

I am looking for a way to add small icons on the plot, like OK or KO symbols, flags, arrows and such.
So far I've seen an example where you can add a background image, but nothing that actually allow me to set a point on the plot, like I could do with a label, and apply there an icon.
Is there a way to do so?
Call me obsessive but as usual this can be done with the epslatex terminal, embedding the image using a set label statement as you would do in regular latex. If your image is so-icon.png, then within gnuplot do:
set terminal epslatex standalone header "\\usepackage{graphicx}"
set output "plot.tex"
set label at screen 0.5,0.5 '\includegraphics{so-icon.png}'
plot sin(x)
And now run pdflatex
pdflatex plot.tex
Your output will be named plot.pdf and look like this:
Change the positioning of the label (help set label for more info) to wherever you want. You can also use the formatting options of \includegraphics{}, for example \includegraphics[width=2cm]{} for a 2cm wide version of your image (sorry, I don't do inches!).
Note that if you want to embed PNG, JPEG, GIF, PDF and so on, the pdflatex command is required, you cannot use regular latex for those.

Make plots inside the WXMaxima GUI

How can I make the plots generated from plotting functions (like plot2d() lie inside the WXMaxima GUI rather than open new Windows? Someone made this in front of me, and I can't find out how he made that.
Thank you.
Just put a "wx" in front of your plot command: use wxplot, wxdraw, wxdraw2d or similar instead of plot, draw or draw2d.

Resources