Добавление более одного yrange в левой части графика с помощью gnuplot - PullRequest
0 голосов
/ 09 января 2020

Можно ли добавить более одного yrange в левой части графика, используя gnuplot? См. Рисунок ниже, пожалуйста.

enter image description here

В идеале мне потребуются команды yrange, такие как y3range, y4range, et c.

Используя multiplot Я не смог получить то, что хотел.

set multiplot
set lmargin at scr 0.2
set bmargin at scr 0.1 # fix bottom margin
set grid
set y2range [0:20]
plot x, 2*x axes x1y2  # this is your actual plot

unset grid
set lmargin at scr 0.2
set bmargin at scr 0.15 # fix bottom margin
set yrange [0:20]    # set yrange to the same as y2 in the first plot
set border 0         # switch off all borders except the left   
unset xtics          # switch off the stray xtics
plot -1000 notitle   # plot something outside of the y(2)range
unset multi

enter image description here Спасибо за вашу помощь.

1 Ответ

0 голосов
/ 10 января 2020

Вы должны установить yranges соответственно так, чтобы ytic и, следовательно, сетка были хорошо выровнены. Добавьте смещение к ytic для настройки расстояний. Чек help xtics.

Код:

### multiple axes
reset session

# common settings for all (sub-)plots
set lmargin at screen 0.15
set bmargin at screen 0.12

set xlabel "my x-title"
set xrange[0:3000]
set grid
set ytics font ",8"

myOffsetY = 0.7

set multiplot
    set ylabel "my 1st y-label" tc rgb "red" offset -2,0
    set yrange [-10:6]
    set ytics -10,2 tc rgb "red" offset 0,0
    plot 0.001*x-10 w l lc rgb "red" notitle

    set xlabel " "
    unset xtics
    unset grid
    set ylabel "my 2nd y-label" tc rgb "green" offset 2,0
    set yrange [-10.0:-2.0]
    set ytics -10, 1 tc rgb "green" offset 0,-myOffsetY
    set format y "%.1f"
    plot 0.002*x -10w l lc rgb "green" notitle

    set ylabel "my 3rd y-label" tc rgb "blue" offset -4,0
    set yrange [-60:20]
    set ytics -60, 10 tc rgb "blue" offset 0,myOffsetY
    set format y "%.0f"
    plot 0.003*x-10 w l lc rgb "blue" notitle

unset multiplot
### end of code

Результат: enter image description here

...