Gnuplot图形在图像顶部透明的应用

Gnuplot图形在图像顶部透明的应用,plot,gnuplot,Plot,Gnuplot,我想在png图形的顶部绘制为透明的,在Gnuplot中没有轴。如果可以在那里安装legend,那就太好了。 它的代码基于我在gnuplot中的许多讨论 这就是这个数字的来源 我想在(2014,83.3)的这个数字中应用它,或者只是大致达到起点。 数据来源:芬兰2030年能源愿景,VTT和p。25 . 尝试基于克里斯托夫的评论和他的回答。 可读代码 set terminal qt size 560,270; set margins 0,0,0,0; set multiplot; # J

我想在png图形的顶部绘制为透明的,在Gnuplot中没有轴。如果可以在那里安装legend,那就太好了。 它的代码基于我在gnuplot中的许多讨论

这就是这个数字的来源

我想在(2014,83.3)的这个数字中应用它,或者只是大致达到起点。 数据来源:芬兰2030年能源愿景,VTT和p。25 .

尝试基于克里斯托夫的评论和他的回答。 可读代码

set terminal qt size 560,270; 
set margins 0,0,0,0;
set multiplot; 

# Just plotting here 
set xrange [2014:2050]; 
set yrange [40:125]; 
set datafile separator " -"; 
set key autotitle columnhead;  
set offset 1,1,0,0; 
d(x) = -0.504 * x + 1097.984; 
c(x) = 83.3; inc(x) = 0.439 * x - 800.65; 
plot d(x) t "Decreasing -0.5\%/yr", c(x), inc(x) t "Increasing +0.5\%/yr", for [i=2:6:2] "model1_range_linear.dat" using 1:(0.5*(column(i)+column(i+1))):(0.5*(column(i+1)-column(i))) with yerror; 

set tmargin at screen 0.2; 
set bmargin at screen 0.15; 
unset border; unset tics; 
unset key;  
set autoscale xy; 
plot 'kulutus_energia_suomi_90_30.png' binary filetype=png with rgbimage; 
unset multiplot;
其中图片为kulutus_energia_suomi_90_30.png,与身体中的图片相同

通缉输出草案

一班轮

set terminal qt size 560,270; set margins 0,0,0,0; set multiplot; set xrange [2014:2050]; set yrange [40:125]; set datafile separator " -"; set key autotitle columnhead; set offset 1,1,0,0; d(x) = -0.504 * x + 1097.984; c(x) = 83.3; inc(x) = 0.439 * x - 800.65; plot d(x) t "Decreasing -0.5\%/yr", c(x), inc(x) t "Increasing +0.5\%/yr", for [i=2:6:2] "model1_range_linear.dat" using 1:(0.5*(column(i)+column(i+1))):(0.5*(column(i+1)-column(i))) with yerror; set tmargin at screen 0.2; set bmargin at screen 0.15; unset border; unset tics; unset key; set autoscale xy; plot 'kulutus_energia_suomi_90_30.png' binary filetype=png with rgbimage; unset multiplot;
我明白了

好的,给你

我所做的步骤如下:

  • 将png打印为全尺寸背景图像(我选择终端窗口的大小与原始图像的大小完全相同):

  • 检查图像中打印边框的位置,并相应地设置gnuplots边距,以便[2014:2040]的xrange位于图像中的正确位置。对于yranges,我使用了与png中相同的方法(顶部可能是110)

  • 完整的脚本是

    set terminal qt size 845,578
    
    set multiplot
    
    # plot the png as full-size background image
    set margins 0,0,0,0
    set autoscale xfix
    set autoscale yfix
    plot 'kulutus_energia_suomi_90_30.png' binary filetype=png with rgbimage
    
    # now plot the lines on top
    height = 578.0
    width = 845.0
    # borders in pixel
    left = 50.0
    right = 646.0
    top  = 515.0
    bottom = 96.0
    
    set tmargin at screen top/height
    set bmargin at screen bottom/height
    # get the position of 2014 on the png, assumes that left is 1990 and right is 2040
    set lmargin at screen left/width + (right - left)/width * 24.0/50.0
    set rmargin at screen right/width
    
    set xrange [2014:2040]
    set yrange [0:110]
    set datafile separator " -"
    d(x) = -0.504 * x + 1097.984
    c(x) = 83.3
    inc(x) = 0.439 * x - 800.65
    unset key
    unset tics
    unset border
    plot d(x) t "Decreasing -0.5\%/yr" lw 2, \
         c(x) lw 2, \
         inc(x) lw 2 t "Increasing +0.5\%/yr", \
         for [i=2:6:2] "model1_range_linear.dat" using 1:(0.5*(column(i)+column(i+1))):(0.5*(column(i+1)-column(i))) with yerror
    
    unset multiplot
    
    结果


    我从中获取了数据文件,不知道它们是否正确。

    请参阅开始。您必须在多点模式下,首先打印png,边距设置为零,然后在这行的顶部打印,您必须手动将范围和打印区域与背景图像之一相匹配。@Christoph,请参阅我在正文中的尝试。你怎样才能把背景烧穿,让我们看得更清楚?也许,一些绘图设置应该改变。我仍然不确定,你到底需要什么。从你给出的几个细节来看,我认为,生成的图像应该是原始png,只有你的附加行。但是:你的范围是从2014年到2050年,巴布亚新几内亚从1990年到2030年。那么,这些线路是否应该只从2014年到2030年?然后使用png中的轴标签和tics。1990是最左边的边界,还是左边的中间,第二个TIC?或者,第二种变体,应该只提取原始图像的一部分,并在使用gnuplot生成的绘图边界内进行绘图吗?我在那里添加了想要的输出。明白了吗?这个问题和答案很难理解,对其他人来说也很有用。你能试着去除所有不必要的东西,只是针对你的具体情况吗?我知道你只想在任意png图片上绘制一个透明背景、没有轴或图例的绘图?
    set terminal qt size 845,578
    
    set multiplot
    
    # plot the png as full-size background image
    set margins 0,0,0,0
    set autoscale xfix
    set autoscale yfix
    plot 'kulutus_energia_suomi_90_30.png' binary filetype=png with rgbimage
    
    set terminal qt size 845,578
    
    set multiplot
    
    # plot the png as full-size background image
    set margins 0,0,0,0
    set autoscale xfix
    set autoscale yfix
    plot 'kulutus_energia_suomi_90_30.png' binary filetype=png with rgbimage
    
    # now plot the lines on top
    height = 578.0
    width = 845.0
    # borders in pixel
    left = 50.0
    right = 646.0
    top  = 515.0
    bottom = 96.0
    
    set tmargin at screen top/height
    set bmargin at screen bottom/height
    # get the position of 2014 on the png, assumes that left is 1990 and right is 2040
    set lmargin at screen left/width + (right - left)/width * 24.0/50.0
    set rmargin at screen right/width
    
    set xrange [2014:2040]
    set yrange [0:110]
    set datafile separator " -"
    d(x) = -0.504 * x + 1097.984
    c(x) = 83.3
    inc(x) = 0.439 * x - 800.65
    unset key
    unset tics
    unset border
    plot d(x) t "Decreasing -0.5\%/yr" lw 2, \
         c(x) lw 2, \
         inc(x) lw 2 t "Increasing +0.5\%/yr", \
         for [i=2:6:2] "model1_range_linear.dat" using 1:(0.5*(column(i)+column(i+1))):(0.5*(column(i+1)-column(i))) with yerror
    
    unset multiplot