2013-10-08 35 views

回答

2

如果可能的话,以正确的方向进行绘图可能会非常麻烦。

我的建议是阴谋与通常的取向一切(即具有“沉积物”轴为x轴,或者更确切地说,是x2轴),旋转所有标签了一下,最后由90度旋转完整的输出( pdf文件,例如pdftk等)。

有了这个,你可以像往常一样使用任何情节样式。在下面的脚本中,我将向您演示如何为两个不同的数据集绘制紫色和黄色填充曲线(使用伪数据)。添加其他峰值应该是直线前进的(用boxesvector绘图样式绘制条形图)。

为了对不同的地块不同ytics,我相关联的特定y - 值具有一定的情节,1=Water,...,4=Gyttja)。

把所有toghether给出下面的脚本:

reset 
set terminal pdfcairo linewidth 2 
outfile='bean' 
set output outfile.'.pdf' 
set encoding utf8 

set x2range [0.5:9000] 
set logscale x2 
set x2tics (1, 5, 10, 50, '' 100, 500, '' 1000, 5000) out 
set x2label 'mg/kg (sediments), µg/L (water)' 
unset xtics 

set yrange[0.5:4.5] 
set ytics ('Water' 1, 'Minerogenic' 2, 'Peat' 3, 'Gyttja' 4) center rotate by -90 out 

set label at graph 0.95, graph 0.05 right rotate by -90 'Nickel' font ',20' front 
# cover possible data overlapping with the label 
set object rectangle from graph 0.9, graph 0 to graph 1,graph 0.2 fillcolor rgb 'white' fillstyle solid noborder front 

unset key 

set macros 
fs1="fillcolor rgb '#fc9e00' linewidth 2 fillstyle solid border lt -1" 
fs2="fillcolor rgb '#9119f7' linewidth 2 fillstyle solid border lt -1" 
# use pseudo data 
set samples 500 
plot '+' using 1:(4-0.3*exp(-(($1-10)/5.0)**4)) axes x2y1 with filledcurves y1=4 @fs1,\ 
    '' using 1:(4+0.2*exp(-(($1-70)/50.0)**4)) axes x2y1 with filledcurves y1=4 @fs2,\ 
    '' using 1:(1-0.4*exp(-(($1-5)/2.0)**2)) axes x2y1 with filledcurves y1=1 @fs1,\ 
    '' using 1:(1+0.1*exp(-(($1-30)/20.0)**2)) axes x2y1 with filledcurves y1=1 @fs2 

set output 
system(sprintf('pdftk %s.pdf cat 1W output %s-rot.pdf', outfile, outfile)) 
system(sprintf('pdftocairo -r 150 -png %s-rot.pdf', outfile)) 

这给出了(常规的和旋转的输出侧由端)与4.6.3:

enter image description here

需要一些东西为伪数据。对于真实的数据文件,绘图线看起来有点不同。不同地块有1y - 方向分离,所以你必须相应地扩展您的数据(这里手工完成与缩放因子sc):

sc = 5.1 
plot 'datafile.txt' using 1:(4 + $2/sc) axes x2y1 with filledcurves y1=4 @fs1 

你当然也可以自动完成缩放,通过提取一些最小/最大值使用stats命令。

+0

非常感谢你的出发点。方向不是问题,我只需要显示多个分布,然后将它们进行比较。 – dstorey