Hi!
I want to flip/rotate the plot in the attachment, such that the right part of the plot is rotated to the left and vice versa. I have used flip command but doesn't seem to work. I have also used camroll(-90), view() and set(gca,'YDir','reverse') to achieve my desired result.
RADF_LS vs PA_scatter2.jpg

 채택된 답변

Bruno Luong
Bruno Luong 2019년 1월 14일
편집: Bruno Luong 2019년 1월 14일

1 개 추천

[x,y]=find(peaks>0.7)
close all
subplot(2,1,1);
plot(x,y,'or')
subplot(2,1,2);
plot(x,y,'or');
% This command will rotate the plot by 180 degree
set(gca,'xdir','reverse','ydir','reverse')

댓글 수: 6

a good idea. To flip a plot you have to use only
set(gca,'xdir','reverse')
for x axis
or
set(gca,set(gca,'ydir','reverse')
for y axis
by using
set(gca,'xdir','reverse','ydir','reverse')
you create a rotation.
But the reverse is not a flip. For a flip you need an axis wich means X=-x for axis x.
For reverse you change the arngment of the value. That means you sort the values in another direktion.
Subha Bose
Subha Bose 2019년 1월 16일
Sayyed,
Many thanks for your reply. I have already tried set(gca,'Ydir','reverse') before posting this question here. But unfortunately, I am not able to get my desired result. Moreover, when I am using X=-x to flip the x axis, the axis values become negative and I am unable to change them to positive x-axis values. There must be a way to preserve x-axis values even after fliipping the axis using -x values.
Bruno Luong
Bruno Luong 2019년 1월 16일
편집: Bruno Luong 2019년 1월 16일
Ydir in reverse with flip top/bottom.
If you want to flip left/right you must perform Xdir reverse.
If you want to rotate 180 degree you have to do both as I showed above.
BTW if you want to thanks Sayyed for his reply post your comment under his post.
Subha Bose
Subha Bose 2019년 1월 16일
Bruno,
Thanks for your reply. I was trying both options but somehow I commented under a different post. My mistake.
I just tried set(gca,'xdir','reverse','ydir','reverse') and it worked, but I need to change the axes values for both X and Y since the axes values have also been reversed. I am trying XTickLabels and YTickLabels for now.
Bruno Luong
Bruno Luong 2019년 1월 16일
편집: Bruno Luong 2019년 1월 16일
If you want to rotate 180 by keeping the same axis range, you need to change the data.
[x,y]=find(peaks>0.7);
xf = min(x(:))+max(x(:))-x;
yf = min(y(:))+max(y(:))-y;
close all
subplot(2,1,1);
plot(x,y,'or')
subplot(2,1,2);
plot(xf,yf,'or');
Subha Bose
Subha Bose 2019년 1월 21일
Bruno,
Thanks for your help. I am getting the desired output now!

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Sayyed Ahmad Fani Yazdi
Sayyed Ahmad Fani Yazdi 2019년 1월 14일

0 개 추천

if your x values are positive nambers you need only use
x=-x
and plot again. It could be flip your plot at y axis

댓글 수: 1

Subha Bose
Subha Bose 2019년 1월 14일
Although the above suggestion worked, once I use -x values, I am unable to insert positive x-axis ticks. Is there a way to flip the plot as well as use positive values for the x-axis ?

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Annotations에 대해 자세히 알아보기

질문:

2019년 1월 14일

댓글:

2019년 1월 21일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by