gnuplot - setting the output size from the command line

I've just installed gpsprof on the Raspberry Pi and am using it to create a plot of GPS performance:

gpsprof -n 10000 -T png | gnuplot >gps.png

which works very well. What I would like to do is to increase the size of the PNG file produced to be larger than its present 640 x 480 pixels. I've tried reading the gnuplot manual and searching online, but it's currently beaten me as to how I might modify the command line above to change the plot size!

Help, please!

--
Cheers, 
David 
Web: http://www.satsignal.eu
Reply to
David Taylor
Loading thread data ...

As the output of gpsprof is (apparently) a gnuplot script, you could pipe it through sed to make sure that it includes a command like

set terminal size 800,600

or whatever.

Reply to
Hils

Thanks, Hils.

I didn't realise it was a script, as it's just today that I've downloaded both utilities and I'm using them for the first time. Could you perhaps provide an example of just how to use sed in this way, as it's another program I've not used at all (nano suffices for my editing needs).

--
Cheers, 
David 
Web: http://www.satsignal.eu
Reply to
David Taylor

Not sure you can directly, gnuplot has far too many options to be useable from the command line so a script is normally used to control it. For example:

set terminal png size 800,600

You can also set the output:

set output "/"

Then try using "gpsprof -n 10000 -T png | gnuplot " where is the filename containing the relevant options.

Other terminal png options:

formatting link

--
Cheers 
Dave.
Reply to
Dave Liquorice

That's old, it's at 4.6 (also current) on RPi:

formatting link

Reply to
A. Dumas

It's not an editor like nano:

formatting link
What you need is a search & replace expression. It helps to know what the actual command looks like. Probably "set term png size 640,480" but spacing, capitalisation or other details (depending on gnuplot version) may be different. So dump the contents to a text file, 10 data points: "gpsprof -n 10 -T png > plot.txt" and look for the "set term" line in the plot.txt file. Then use something like:

gpsprof -n 10 -T png | sed s/png size 640,480/png size 800,600/ | gnuplot > gps.png

(test with 10 points, new size 800 x 600). If you're lucky, a static search expression like this will suffice and you won't need regular expressions.

Reply to
A. Dumas

I forgot quotes around the sed argument, needed because of the spaces.

Reply to
A. Dumas

It's what google regurgitated, good enough for an example of "set terminal png".

Others have posted that gpsprof outputs a gnuplot script maybe that can be told the terminal size to use? It has a [-T terminal] option, worth trying -T png size 800,600 or -T "png size 800,600"?

--
Cheers 
Dave.
Reply to
Dave Liquorice

Maybe, maybe not. From the 4.6 doc:

"In earlier versions of gnuplot, some terminal types used the values from set size to control also the size of the output canvas; others did not. The use of ?set size? for this purpose was deprecated in version

4.2. Since version 4.4 almost all terminals now behave as follows:"
Reply to
A. Dumas

You also forgot the -e flag to tell sed it is a command, not a file.

However, there probably is a better way to tell gpsprof to insert output in the script.

Reply to
Rob

Dave & A.Dumas,

Many thanks to you both for your help. I had not appreciated that gnuplot was actually taking its input from what was effectively a text file, although on reflection, yes, it's obvious.

As the runs take an hour ore more (really should be 12 hours!) it now become less important to automate the setting of the output size, as I can split the task up into three steps:

gpsprof -n 4000 -T png > gps.txt nano gps.txt (to add the plot size manually) gnuplot < gps.txt > gps.png

but from all your inputs (and Rob, whose input appeared as I was typing) I could have:

gpsprof -n 10 -T png | sed -e 's/png/png size 800,600/' | gnuplot > gps.png

Check that command-line and it works. The original output from gpsprof didn't have the "640,480" after all.

Thanks for all your help - I've made a note for next time!

--
Cheers, 
David 
Web: http://www.satsignal.eu
Reply to
David Taylor

D'oh! Thanks.

Reply to
A. Dumas

As gpsprof just passes/converts the argument of the -T option to the gnuplot set terminal command, this can be done simply as

gpsprof -n 10000 -T 'png size 800,600' | gnuplot >gps.png

Rob

Reply to
Rob Windgassen

On 18/02/2014 00:20, Rob Windgassen wrote: []

Thanks, Rob. That's helpful - I wish they had that as an example in the documentation.

--
Cheers, 
David 
Web: http://www.satsignal.eu
Reply to
David Taylor

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.