0

I have a data file (data.txt). I can plot the data with using gnup command. Like;

gnup -p data.txt -xl 'Hours' -yl 'Data (m)'

I need to save the plot (for example png format) after executing above command without plotting the data. Is that possible?

deepblue_86
  • 1,194
  • What do you mean by without plotting the data? Without displaying? – Anwar Aug 09 '16 at 13:22
  • yes without displaying. – deepblue_86 Aug 09 '16 at 13:23
  • I don't find any gnup command with standard installation. what was that? Are you using Ubuntu? – Anwar Aug 09 '16 at 13:34
  • What exactly is gnup? is it some alias of your own? Normally, you'd plot directly to file by setting the gnuplot term (or terminal) to the desired output file type e.g. set term png or set term pdfcairo. Run set term (without any arguments) at the gnuplot prompt to get a complete list of the available terminal types on your system – steeldriver Aug 09 '16 at 13:36
  • 1
    See if this helps http://stackoverflow.com/questions/24415671/gnuplot-do-not-show-graph-after-saving-into-file – Anwar Aug 09 '16 at 13:37

1 Answers1

1

gnuplot has a set output command that I use to save a copy of my plot:

#!/bin/bash 
# Run this script after synching the Palm with $HOME/Visor/.last

# Weight - extract my weight data fron the Visor, clean it
# up, and feed it to gnuplot

target=$HOME/Visor/var/Weight
visorhome="$HOME/Visor"
gnuplotdata="${target}.pltdata"
gnuplotout="${target}.ps"

# ... data prep omitted - data to plot is in $gnuplotdata 

gnuplot <<EOF
set title "Weight and running average, in kilograms, for Walt Sullivan"
set timefmt "%y/%m/%d"
set xdata time
set format x "%y/%m/%d"
plot "$gnuplotdata" using 1:2 with linespoints, "" using 1:3 with linespoints;
pause 10 "Plot will close in 10 seconds, see $gnuplotout"
set terminal postscript enhanced color landscape
set output "$gnuplotout"
replot
EOF

exit 0

To learn more, type:

$ gnuplot
gnuplot> help set output
 By default, screens are displayed to the standard output. The `set output`
 command redirects the display to the specified file or device.
...
waltinator
  • 36,399