简体   繁体   中英

How can i use gnuplot commands on a shell script

Hi guys im trying to build a graphic bar with gnuplot. I have to put the graphic in a png file and then present it in html page. Im having problems with using the plot command in my script.

If you know to use gnuplot commands in a script, i would aprecciate your help!

You can easily use gnuplot commands within an interactive shell, on in a shell script:

echo 'set term pngcairo; set output "file.png"; plot x' | gnuplot

You could also put your commands in file.gnuplot and then execute

gnuplot file.gnuplot

from within your shell script or interactive shell. If instead of writing to file you just want the graph to pop up using the default gnuplot terminal, you can add -persist :

echo 'plot x' | gnuplot -persist

You can also use shell commands inside a gnuplot script or gnuplot interactive session via a system() call, but that's a separate topic.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM