2
votes

I know this was asked before a while ago using images for points but I was wondering whether someone can provide more detailed help, or whether any recent changes in gnuplot make this easier?

My question is slightly different and I didn't want to reopen a 6yo question

I'm trying to produce a plot for a weather forecast similar to this: AIX weather widget screenshot

I have some data from openweathermap's api, and an icon set - plotting the temp, rainfall, etc is trivial.. What I would like to do is plot an image/ icon to show the weather just above the temperature plot

It looks like center would work, but how can I get center to correspond to a datapoint - or more accurately to a few pixels above the datapoint

Any alternative suggestions would also be gratefully received

1
Could you please post what you've tried so far?bibi
I've not really made any progress on this yet as I'm not sure which direction to take. As mentioned above I think center could work if I can place it correctly. I was hoping that there would be a function to use an image as a column/ box Another option could be to use rgbimage and try to manually place the images according to the data point coordinates.. This is basically why I'm asking for help as I'm not sure which option is the best way to proceeddraki

1 Answers

1
votes

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

First step is to build lists (space separated elements in strings X, Y, and IMG) with the plot data. Then a for-loop plots the images at the desired location. The dx and dy need to be adjusted depending on your image size and the plot ranges (could be automated with GPVAL_* data).

enter image description here