1

Using a flow where I do a 'scratch' plot first to then gather the 'GPVAL_DATA_Y_MIN / MAX' variables for framing the plot size. I then send the actual plot into PNG file. Still the 'scratch' plot command flashes up on screen which I want to avoid. I was doing a 'help set terminal' to see the available terminals (in my gnuplot session) and was looking for something like 'blind' or 'null' but couldn't find any like that. Is there such a terminal? And what is it's name? (Using gnuplot 4.6 patchlevel 7)

Thanks, Gert

Gert Gottschalk
  • 1,658
  • 3
  • 25
  • 37
  • 1
    `set terminal unknown`. And why do you need those values? You could also use the `stats` command or `set autoscale yfix` ... – Christoph Mar 22 '17 at 22:12
  • I would have given Christoph's idea the accepted-answer tag if he had sent it as answer. Setting to unknown is the best solution as it eliminates the rendering that will still be happening in maji's answer. So it will be more runtime efficient. – Gert Gottschalk Mar 24 '17 at 03:36

2 Answers2

3

Since I don't know exactly, how you actually use those values, here are some different possibilities:

  1. Gnuplot's "blind" terminal is called unknown:

    set terminal unknown
    plot "data.dat"
    
    set terminal pngcairo
    set output "output.png"
    set yrange[GPVAL_DATA_Y_MIN:GPVAL_DATA_Y_MAX] 
    replot
    

    Variants of this would be to wrap the set terminal unknown call in set terminal push and set terminal pop to go back to the previous terminal.

  2. Use the stats command:

    f = "data.dat"
    stats f using 2 nooutput
    
    set yrange [STATS_min:STATS_max]
    plot f
    
  3. If you don't need the values for computations, but only to fit the yrange to your actual data range, then use

    set autoscale yfix
    

    or

    set autoscale yfixmax
    

    possibly combined with set offsets.

Christoph
  • 47,569
  • 8
  • 87
  • 187
  • Yes, #1 is what I do, with some 20% scale multiplier for the axes so the the top of the curve doesn't bump the top of the frame. #2 the 'stats' would do the same. Is 'stats' a newer construct? I don't remember it form older version. – Gert Gottschalk Mar 24 '17 at 22:40
0

Try to send the output to the null device:

On Linux:

set terminal png
set output "/dev/null"
plot sin(x)
set output "real_output.png"
...

On Windows:

terminal png
set output "nul"
plot sin(x)
set output "real_output.png"
...

Read this SO question or this Wikipedia entry, especially for Windows details.

maij
  • 4,094
  • 2
  • 12
  • 28