0% found this document useful (0 votes)
63 views1 page

Saving Graphs in Gnuplot: Example

To save graphs from gnuplot in .png format, set the terminal type to png, use set output to specify the filename for each graph, plot the graph, and unset output after all graphs are plotted to return to displaying on screen. For example, to save plots of sin(x) and e^-x^2 in separate files, set terminal and output for each, plot, unset output and set terminal back to default after.

Uploaded by

Subhadip Pal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
63 views1 page

Saving Graphs in Gnuplot: Example

To save graphs from gnuplot in .png format, set the terminal type to png, use set output to specify the filename for each graph, plot the graph, and unset output after all graphs are plotted to return to displaying on screen. For example, to save plots of sin(x) and e^-x^2 in separate files, set terminal and output for each, plot, unset output and set terminal back to default after.

Uploaded by

Subhadip Pal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 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

You might also like