How to insert two X axis in a Matlab a plot

后端 未结 3 2119
悲哀的现实
悲哀的现实 2020-12-01 12:51

I would like create a Matlab figure with a double X axis (m/s and km/h) with the same plot.

I have found plotyy and - in Matlab reposity - plotyyy, but I am looking

3条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-01 13:45

    The best way i can think to do it is to use 2 plots, for example, you can split the plot into a large and small section by doing something like this:

    subplot(100, 1, 1:99) // plot your graph as you normally would
    plot(...
    
    subplot(100, 1, 100) // Plot a really small plot to get the axis
    plot(...)
    b = axis()
    axis([b(1:2), 0, 0]) // set the y axis to really small
    

    This is untested, you might need to fiddle around a little but it should hopefully put you on the right track.

提交回复
热议问题