How to flip the x-axis?

前端 未结 1 676
-上瘾入骨i
-上瘾入骨i 2021-01-23 14:32

I am plotting amplitude reconstruction of FMCW radar.

I want to flip the inside graph only. However the x axes shoud be the same. How shoud i do it. Below is my code f

相关标签:
1条回答
  • 2021-01-23 15:07

    As be found in the axes documentation, it's simply:

    set(gca,'XDir','reverse')
    

    If you just want the labels flipped, just flip the labels:

    plot(1:10,1:10)
    set(gca, 'XTickLabel', flipud( get(gca, 'XTickLabel') ))
    

    or for Matlab R2014b or higher a little simpler:

    a = gca;
    a.XTickLabel = flipud(a.XTickLabel);
    

    But be aware, that the labels won't change anymore when resizing the figure. So fix the size in advance.

    0 讨论(0)
提交回复
热议问题