1

I need the calculated y-values by gnuplot. How do I get those values. In this example, de values 100 and -700.

Example

I looked between all default variables gnuplot but could not find it.

Let me try to explain:

First an example enter image description here

Here you can see the problems. I have the offset set to white into the column when possible en black out of the column. But that depends of course on the values y-min and y-max. I think, when I have these values I can calculate the offset. Now I have only a hard value;

"<tail -60 log.txt" u 1:(-($12)):($12>300 ? (-$12) : sprintf("")) w labels left font ",10" tc rgb "white" rotate offset 0,0.2 notitle,\
"<tail -60 log.txt" u 1:(-($12)):(($12<=300 && $12>0) ? (-$12) : sprintf("")) w labels left font ",10" tc rgb "black" rotate offset 0,-1.7 notitle,\

Maybe there is a trick or other solution?

Here example number 3.Example 3 I tried:

set terminal unknown
plot "<tail -60 log.txt" using 9:12
print  GPVAL_Y_MAX, GPVAL_Y_MIN
replot

And I get the values: 650,0 150,0 and they are the values of column 12, thats ok but not the values of the y-axis and only below the zero. (see example 3) What do I wrong or do not understand?

Steffen Moritz
  • 7,277
  • 11
  • 36
  • 55
Con
  • 197
  • 2
  • 10
  • That situation is quite tricky since the positioning doesn't depend only on the y-values but also on the selected font, font size, absolute plot size etc. I'm not sure if you can work out a universally applicable solution. If having the y-max and y-min values would help you, you still would have to use something like I proposed in my solution to get those values. But you don't need to run your full script. Possibly only using `plot 'file.txt' u 1:(-$12) w p, '' u 1:11 w p` would be enough to get the information. – Christoph Oct 09 '14 at 06:37
  • Christoph, you show me the way and I found the (my) solution; `set terminal unknown plot ' – Con Oct 09 '14 at 22:05

1 Answers1

0

These values are the result of gnuplot's autoscaling. You'll have access to those values only after plotting via the variables GPVAL_Y_MIN and GPVAL_Y_MAX (type show variables all after plotting to see all available variables).

If you need those values for something in the plot you must plot to the unknown terminal first and then to your actual terminal:

set terminal unknown
plot 1.01*x

set terminal wxt enhanced
set label left at graph 0.1,0.9 sprintf('y_{max} = %.2f', GPVAL_Y_MAX)
replot
Christoph
  • 47,569
  • 8
  • 87
  • 187
  • Then i am in trouble, i need those values to calculate the offset of the labels. – Con Oct 08 '14 at 14:48
  • Well, then you should describe your actual problem. You know, that you can use differenct coordinate systems to position a label? http://stackoverflow.com/a/23180595/2604213 – Christoph Oct 08 '14 at 15:34