0
votes

I want to make a PNG image of my plot but would like to overlay this on a map. To do this we need the boundary coordinates and a simple png without any axes or tic marks ending up in the image. I tried turning of the ticmarks by unset xtics / ytics but then the value of GPVAL_X_MAX becomes the same as GPVAL_DATA_X_MAX. Is there any way to find the min/max values of the plot without the using the tics? Example:

plot [-10:10] sin(x),atan(x),cos(atan(x)); 
show variables all;

Gives GPVAL_Y_MIN = -1.50, GPVAL_Y_MIN=-1.47... Whereas:

unset xtics;
unset ytics;
plot [-10:10] sin(x),atan(x),cos(atan(x)); 
show variables all;

gives GPVAL_Y_MIN = -1.47, GPVAL_Y_MIN=-1.47...

edit: Fixed, I finally just removed all style/layout of the tics and scaled their size down to zero. This way GPVAL_X_MIN etc retain the value of the actual boundaries instead of the min/max vals of the dataset.

1
It's not fully clear to me what you have and what you want. What think I understood: you have an image of a map (as PNG?) with a given image size and you want to overlay a plot from gnuplot onto this image? Do you want to do this with gnuplot or with some other software? Can you please explain or illustrate? - theozh

1 Answers

0
votes

A simple brute force solution would be to plot twice. The first time with tics enabled, just to store the value of the variables you're after, such as GPVAL_DATA_Y_MIN. You can then plot a second time with tics disabled.

set terminal pngcairo
set output 'plot.png'
plot [-10:10] sin(x),atan(x),cos(atan(x));
y_min = GPVAL_Y_MIN
data_y_min = GPVAL_DATA_Y_MIN

unset xtics
unset ytics
set output 'plot.png'
replot

print sprintf("GPVAL_Y_MIN = %f", y_min)
print sprintf("GPVAL_DATA_Y_MIN = %f", data_y_min)

Output:

GPVAL_Y_MIN = -1.500000
GPVAL_DATA_Y_MIN = -1.471128