如何翻转x轴?

时间:2015-08-05 06:56:44

标签: matlab plot matlab-figure

我正在绘制FMCW雷达的振幅重建。 enter image description here

我只想翻转内部图表。但是x轴应该是相同的。我怎么做到这一点。下面是我的绘图代码。

DEPRECATION: --no-install, --no-download, --build, and --no-clean are deprecated.  See https://github.com/pypa/pip/issues/906.
Downloading/unpacking BeautifulSoup==3.2.1
  Downloading BeautifulSoup-3.2.1.tar.gz
  Running setup.py (path:/tmp/pycharm-packaging0.tmp/BeautifulSoup/setup.py) egg_info for package BeautifulSoup
    Traceback (most recent call last):
      File "<string>", line 17, in <module>
      File "/tmp/pycharm-packaging0.tmp/BeautifulSoup/setup.py", line 22
        print "Unit tests have failed!"
                                      ^
    SyntaxError: invalid syntax
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):

  File "<string>", line 17, in <module>

  File "/tmp/pycharm-packaging0.tmp/BeautifulSoup/setup.py", line 22

    print "Unit tests have failed!"

                                  ^

SyntaxError: invalid syntax

----------------------------------------
Cleaning up...

Command python setup.py egg_info failed with error code 1 in /tmp/pycharm-packaging0.tmp/BeautifulSoup
Storing debug log for failure in /home/jatin/.pip/pip.log

1 个答案:

答案 0 :(得分:5)

正如axes documentation中所见,它只是:

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

如果您只想翻转标签,只需flip标签:

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

或Matlab R2014b或更高版本更简单一点:

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

enter image description here

但请注意,在调整数字大小时,标签不再发生变化。所以要事先确定尺寸。