Почему у меня проблема с двумя осями справа, когда я использую многоосную функцию? - PullRequest
1 голос
/ 17 апреля 2019

У меня возник ряд проблем при определении осей в моем графике, и я хотел бы поделиться им с вами, чтобы увидеть, если среди всех мы можем найти ошибку

Я нашел на этом сайте пользователякто сделал это похожим.Моя идея состоит в том, чтобы иметь одну ось слева и две справа.Но по какой-то причине, это, вероятно, глупо, это не выглядит правильно.

Мой код выглядит следующим образом:

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

Проблема в том, что две оси справа не отображаются правильно, а линии данных ... либо.

Заранее спасибо

1 Ответ

0 голосов
/ 17 апреля 2019

Не стесняйтесь добавлять результаты своего графика и указывать ссылку, где вы нашли нечто похожее.

Одним из способов может быть изменение полей графика и построение другого фиктивного графика только для третьего (разделенного) ось.Кстати, вы можете поместить две строки данных в один участок.

Код:

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

даст что-то вроде:

enter image description here

...