How to flip the x-axis?

纵饮孤独 提交于 2019-12-02 05:45:51

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!