Gnuplot-在点处绘制图像 [英] Gnuplot - plot image at point
问题描述
我知道这是在不久前问的使用图像作为点但是我想知道是否有人可以提供更详细的帮助,或者gnuplot中的任何最近更改是否使此操作更容易?
我的问题略有不同,我不想重新提出一个6yo问题
我正在尝试为类似于以下内容的天气预报绘制图: AIX天气小部件屏幕截图
我从openweathermap的api中获得了一些数据,并且有一个图标集-绘制温度,降雨量等非常简单.我想做的是绘制一个图像/图标,以在温度图上方显示天气>
center
似乎可以工作,但是如何获取center
对应一个数据点-或更准确地说,是对应于该数据点上方的几个像素
我们也将不胜感激地收到任何其他建议
此处分两个步骤进行操作:
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
第一步是使用绘图数据构建列表(在字符串X,Y和IMG中用空格分隔的元素).然后,for循环在所需位置绘制图像. dx和dy需要根据您的图像大小和绘图范围进行调整(可以使用GPVAL_*
数据自动进行.)
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
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).
这篇关于Gnuplot-在点处绘制图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!