使用多轴功能时,为什么右边的两个轴有问题? [英] Why do I have a problem with the two axes on the right when I use the multi-axis function?

查看:109
本文介绍了使用多轴功能时,为什么右边的两个轴有问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在定义图形中的轴时遇到了一系列问题,我想与您分享一下,看看我们中是否可以找到错误

I am having a series of problems when defining the axes in my graphic and I would like to share it with you to see if among all we can find the error

我在此网站上找到与之相似的用户.我的想法是在左侧有一个轴,在右侧有两个轴.但是由于某种原因,它可能很愚蠢,无法正确显示.

I have found on this website a user who has made it similar. My idea is to have one axis on the left and two on the right. But for some reason, it's probably silly, it does not appear correctly.

我的代码如下:

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

问题是右侧的两个轴未正确显示,并且数据线也出现了.

The problem is that the two axes on the right do not appear correctly, and the data lines ... either.

预先感谢

推荐答案

不要犹豫,追加绘图结果,并在发现相似之处提供参考.

Do not hesitate to append your plot result and give the reference where you have found something similar.

一种方法可能是更改图形的边距,并仅为第三个(分离的)轴绘制另一个虚拟图形.顺便说一下,您可以将两条数据线放到一个图中.

One way might be to change the margins of the graph and plot another dummy graph just for the third (separated) axis. By the way, you can put two datalines into one plot.

代码:(已修改以使其复制并粘贴包括数据的内容)

Code: (edit: modified to make it copy&paste including data)

### 3 y-axes
reset session

$Data <<EOD
 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
EOD

set key off
set autoscale  y
set autoscale y2

set lmargin 10
set tmargin 2
set bmargin 4
set rmargin 20

set multiplot

    ##### first plot
    set xlabel "Temperature / {/Symbol \260}C" font ",11"
    set xrange [0:1500]

    set ylabel "Thermal Diffusivity / (mm^2/s)" textcolor rgb "red" font ",11"
    set yrange[0:16]
    set ytics nomirror

    set y2range[0:40]
    set y2tics nomirror
    set y2label "Thermal Conductivity / (W/m K)" offset -1,0 textcolor rgb "green" font ",11"
    set grid xtics, ytics
    
    plot $Data u 1:2 axes x1y1 smooth cspline lc rgbcolor "red", \
            '' u 1:4 axes x1y2 smooth cspline lc rgbcolor "green"

    ##### Second plot
    unset xlabel 
    unset ylabel
    unset y2label
    unset tics

    set y2range[0:2]
    plot $Data u 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" font ",11"
    set y2tics nomirror offset 0,0
    plot NaN    # plot nothing

unset multiplot
### end of code

结果:

这篇关于使用多轴功能时,为什么右边的两个轴有问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆