Gnuplot - plotting a plot at a point

I know this was asked a while ago using images for points , but I was wondering if anyone could provide more detailed help or what recent changes to gnuplot make this easier?

My question is slightly different and I didn't want to reopen the 6th question

I am trying to create a plot for a weather forecast like this: Screenshot of AIX Weather Widget

I have data from the openweathermap api and the icon set is shading the pace, precipitation, etc. trivial. What I would like to do is draw an image / icon to show the weather just above the temperature graph

It looks like it center

will work, but how can I get center

to match the datapoint, or more precisely a few pixels above the datapoint

Any alternative suggestions would also be greatly appreciated

+2


source to share


1 answer


Here's how to do it in two steps:

IMG_LIST="cloud.png sun.png"
X=""
Y=""
IMG=""
storedata(x,y,index_img)=                               \
        (X=X.sprintf(" %f",x),                          \
        Y=Y.sprintf(" %f",y),                           \
        IMG=IMG." ".word(IMG_LIST,int(index_img)),y)

plot '-' using 1:(storedata($1,$2,$3))
0.5 23 2
1.5 27 2
2.5 19 1
e

plot [0:3][0:40] for [i=1:words(IMG)] word(IMG,i) binary filetype=png center=(word(X,i),word(Y,i)) dx=0.005 dy=0.05 with rgbimage notitle

      



The first step is to create lists (items separated by spaces on lines X, Y and IMG) with the graph data. Then the for-loop displays the images in the right place. Dx and dy need to be adjusted depending on image size and graph ranges (could be automated with data GPVAL_*

).

enter image description here

+1


source







All Articles