如何翻转X轴? [英] How to flip the x-axis?
本文介绍了如何翻转X轴?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在绘制FMCW雷达的幅度重建图.
I am plotting amplitude reconstruction of FMCW radar.
我只想翻转内部图形.但是,x轴应该相同.我应该怎么做.下面是我的绘图代码.
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 for plotting.
for i = 1:2500 %%%% dividing each row by first row.
resd(i,:) = res3(i,:)./res3(1,:);
end
f = fs/2*linspace(0,1,nfft/2+1); %%%% defining frequency axes
K = BW/Tm;
t = f/K;
deltaf = 1/max(t);
fmax = 1 / t(2)-t(1);
f1 = 0:deltaf:fmax;
% f1 = fmax:deltaf:0;
f2 = f1 + fc;
%%%%%% Amplitude reconstruction
figure(1),plot(f2,abs(resd));
[![enter image description here][1]][1]
推荐答案
As be found in the axes documentation, it's simply:
set(gca,'XDir','reverse')
如果只希望翻转标签,只需 flip
标签:
If you just want the labels flipped, just flip
the labels:
plot(1:10,1:10)
set(gca, 'XTickLabel', flipud( get(gca, 'XTickLabel') ))
或对于Matlab R2014b或更高版本更简单:
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.
这篇关于如何翻转X轴?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文