Sie sind auf Seite 1von 1

Saving graphs in gnuplot

Saving graphs in .png format - the steps:


• set terminal png
• set output lename1.png
• plot gure1

• set output lename2.png (if you wish to save more graphs)


• plot gure2
• ...
• unset output

• set terminal wxt


Note that instead of lename1.png etc. you will have to supply the actual
lename you want (this has to be given within quotes). Also, as should be
obvious, the
plot gure1 etc.
should be complete commands for plotting graphs.
Note also that the last two commands are for reverting to the original mode
where graphs will be shown on screen. Of course, if saving the graph(s) is the
last thing that you want to do in a gnuplot session, you may just quit instead.

Example
Let's say we wish to plot a graph of sin (x) from x = −2 to x = +2 and save
it in the le sinegraph.png and then save a graph of e−x from x = −5 to
2

x = +5 in the le bell.png. The steps should be :

set terminal png


set output sinegraph.png
plot [-2:2] sin(x)
set output bell.png
plot [-5:5] exp(-x**2)
unset output
set term wxt

Das könnte Ihnen auch gefallen