轴上的Gnuplot图像 [英] Gnuplot image on axis
问题描述
我正在尝试通过某种环境来建模特定的进度. x轴表示环境中的位置(基于x坐标).
I'm trying to model a certain progress through some environment. The x axis would represent the location (based on x coordinate) in the environment.
为了清楚起见,我想在我的情节的x轴上绘制环境图像(基于.png)(环境相当宽而不是那么高,因此看起来应该不错) ,基本上是xtics/x轴标签.
In order to make this clear, I'd like an image of the environment (based on a .png) on the x axis (the environment is rather wide and not that high, so it should look good) of my plot, basically as an xtics/x-axis label.
您对此有何建议?
提前谢谢!
推荐答案
您可以使用一个plot
命令或使用multiplot
绘制图像和数据.第一个变体比较容易,但是图像在绘图内,另一个变体稍微复杂一些,但是可以任意定位轴图像".
You can either plot both the image and the data in one plot
command, or with multiplot
. The first variant is easier, but the image is inside the plot, the other is a bit more complicated, but allows arbitrary positioning of the "axis image".
该轴的虚拟图像"gradient.png"是
The dummy image "gradient.png" for the axis is
set yrange[0:1]
set xrange[0:1]
plot 'gradient.png' binary filetype=png dx=0.0015 dy=0.002 with rgbimage t '',\
x**2
结果是:
set yrange[0:1]
set xrange[0:1]
set lmargin at screen 0.1
set rmargin at screen 0.98
set tmargin at screen 0.98
set bmargin at screen 0.2
set xtics offset 0,-1.5
set xlabel 'xlabel' offset 0,-1.5
set ylabel 'ylabel'
set multiplot
plot x**2
set tmargin at screen 0.2
set bmargin at screen 0.15
unset border
unset tics
unset xlabel
unset ylabel
unset key
set autoscale xy
plot 'gradient.png' binary filetype=png with rgbimage
unset multiplot
如您所见,这需要更多的努力.详细说明:
As you can see, this requires a bit more effort. To explain the details:
-
必须设置明确的边距,以便可以将轴图像放置在主图的正下方.
You must set explicit margins so that the axis image can be placed exactly below the main plot.
在绘制轴图像之前,必须删除tics
,labels
,将范围重置为autoscale
等(因此,还必须设置固定的lmargin
和rmargin
).
Before plotting the axis image, you must remove tics
, labels
, reset ranges to autoscale
etc. (Therefore you must also set fixed lmargin
and rmargin
).
要绘制图像本身,请使用打印样式with rgbimage
.
To plot the image itself, use the plotting style with rgbimage
.
您必须微调xtics
和xlabel
偏移量以及标记.
You must fine-tune the xtics
and xlabel
offset, as well as the marings.
生成的图像为:
这篇关于轴上的Gnuplot图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!