views:

201

answers:

2
+1  Q: 

gnuplot png export

How to "export" a graph to png or something insertable in Word ? I know there are a dozen tutorials for this on the 'net, but I'm having trouble just finding a simple example.

A: 

Follow these;

Once you are happy with your plot, set your output terminal type to ``Postscript.''

gnuplot> set terminal postscript

Graphics will be written in Postscript format, the language understood by our printers, instead of the format understood by the windowing system. Then specify a file name for your postscript output.

gnuplot> set output 'myfile.ps'

Then write your plot to the file by replotting.

gnuplot> replot

To send your Postscript file to the printer, use the lpr shell command, (OPTIONAL)

$ lpr myfile.ps

If you would like to continue working with your plot in a graphics window, you will need to return the output and terminal settings to normal by typing

gnuplot> set terminal x11

gnuplot> set output

A great tutorial is here

berkay
I mean no disrespect, but if I needed an output in PostScript format, I would've asked for such. I do not mean to print it at all. Just need to look at it, and insert it in some Word documents, neither which I can do with .ps (which is a dying format on win platforms).
ldigas
i just write the print to use it optional, you can also easily make myfile.png, i work in Linux so i get use to write that, not a big deal.
berkay
Sorry. It's late and I need to get this working, and it's giving me headaches (therefore the crankyness). Anyway, I tried using "set output ...", but after plotting ("plot sin(x)") it just leaves me with an empty file (zero size). Do you know maybe what could cause that ?
ldigas
i edited, now it works just for .ps. also you can use ghostview to see .ps in Windows OS.
berkay
I've changed my question and accepted this as an answer since I had to thank you somehow for your help. Posted the other part as a separate question ... thanks again!
ldigas
A: 

On windows, you can

set terminal windows

for the output to a window. Next for png output,

set terminal png

This should work on the native windows gnuplot binary.

Sid H