How to plot multiple y-axes?

后端 未结 2 791
我寻月下人不归
我寻月下人不归 2021-01-02 17:00

I saw this graph and only for the curiosity sake was wondering whether it was possible to plot figure with multiple y-axis as in the figure

2条回答
  •  渐次进展
    2021-01-02 17:15

    Yes, you can have two y axes for free, e.g.

    plot x, x**2 axes x1y2
    

    The axes specification lets you put things on x1y1, x2y1, etc. If you want more than two things plotted on the same y axes you have to normalize things yourself:

    plot 'data1.dat' using 1:($2/MAX_1), \
      'data2.dat' using 1:($2/MAX_2), \
      'data3.dat' using 1:($s/MAX_3)
    

    The variables MAX_X can be precalculated by using the stats command in gnuplot 4.6+, or you can put them in manually.

提交回复
热议问题