在我的图形中定义轴时遇到一系列问题,我想与你分享,看看我们是否能找到错误
我在这个网站上找到了一个类似的用户。我的想法是左边有一个轴,右边有两个轴。但由于某种原因,它可能是愚蠢的,它似乎不正确。
我的代码如下:
set terminal postscript eps enhanced color "Times-Roman" 15
set output "TC_8.eps"
set multiplot
set xlabel "Temperature/{/Symbol \260} C"
set xrange [0:1500]
set key off
set autoscale y
set autoscale y2
##### first plot
set yrange[0:15]
set ylabel "Thermal Diffusivity/(mm^2/s)" textcolor rgb "red"
plot "dt8.txt" using 1:2 smooth cspline lc rgbcolor "red"
##### Second plot
set y2range[0:40]
set y2tics nomirror
set y2label "Thermal Conductivity/ (W/m K))" offset 8, 0 textcolor rgb "green"
plot "dt8.txt" using 1:4 axes x1y2 smooth cspline lc rgbcolor "green"
##### Third plot
set y2range[0:2]
set y2tics no mirror
set y2label "Specific Heat/ (J/(g K))" offset 16, 0 textcolor rgb "blue"
plot "dt8.txt" using 1:3 axes x1y2 smooth cspline lc rgbcolor "blue"
unset multiplot
数据系列非常简单
20 11.466 0.733 28.894
499.6 6.338 1.119 24.38
998.9 5.3 1.292 23.542
1499 4.639 1.645 26.247
问题是右边的两个轴没有正确显示,数据线也是如此。
提前致谢
不要犹豫,添加你的情节结果,并在你找到类似的地方给出参考。
一种方法可能是更改图形的边距,并为第三个(分离的)轴绘制另一个虚拟图形。顺便说一下,你可以把两个数据线放到一个图中。
码:
reset session
set terminal postscript eps enhanced color "Times-Roman" 15
set output "TC_8.eps"
set multiplot
set key off
set autoscale y
set autoscale y2
set lmargin 10
set tmargin 2
set bmargin 4
set rmargin 20
##### first plot
set xlabel "Temperature/{/Symbol \260} C"
set xrange [0:1500]
set ylabel "Thermal Diffusivity/(mm^2/s)" textcolor rgb "red"
set yrange[0:15]
set ytics nomirror
set y2range[0:40]
set y2tics nomirror
set y2label "Thermal Conductivity/ (W/m K))" offset -1,0 textcolor rgb "green"
plot "dt8.txt" using 1:2 axes x1y1 smooth cspline lc rgbcolor "red", \
'' using 1:4 axes x1y2 smooth cspline lc rgbcolor "green"
unset xlabel
unset ylabel
unset y2label
unset tics
##### Second plot
set y2range[0:2]
plot "dt8.txt" using 1:3 axes x1y2 smooth cspline lc rgbcolor "blue"
##### Third plot
set rmargin 10
set border 8 # only right border visible
set y2label "Specific Heat/ (J/(g K))" offset -1,0 textcolor rgb "blue"
set y2tics nomirror offset 0,0
plot -1 # plot some line out of range
unset multiplot
set output
会给出类似的东西: