1

I have a python code that has the following line:

os.system("gnuplot data3.gnu")

my data3.gnu has the following commands

plot "data3.txt"
pause -1
set terminal png 
set output 'plot10.png'

so what i want it to do is show me the plot which it does then when i exit it saves the plot to a file called "plot10.png" it is ploting data3.txt fine however it is not saving the file.

Thanks for the help

1 Answer 1

1

The problem with your code is that you need to set terminal and output before actually plotting anything. However, it then won't show the plot since the data is written straight to the disk.

In Gnuplot 5, there should an export button in the GUI, but in case you don't have it or are looking for a way to save programmatically, use replot to repeat the last plotting command:

plot "data3.txt"
pause -1
set terminal png 
set output 'plot10.png'
replot
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.