필터 지우기
필터 지우기

same y label on both sides of contourf

조회 수: 1 (최근 30일)
Richard
Richard 2012년 8월 16일
댓글: Jan 2019년 2월 12일
From the following example:
[C,h] = contourf(peaks(20),10);
colormap autumn
How would I include the yaxis on the left hand side as well as the right hand side i.e. have the yaxis on both sides of the plot?

채택된 답변

José-Luis
José-Luis 2012년 8월 16일
Here goes, plotting an extra axes in the same position, making it transparent and changing the location of the y-axis.
[C,h] = contourf(peaks(20),10);
colormap autumn
add = gca;
extra = axes('Position',get(add,'Position'),'Color','none','XTick',[],'YAxisLocation','right');
linkaxes([add extra],'xy');
The set Position is probably unnecessary.

추가 답변 (1개)

Oleg Komarov
Oleg Komarov 2012년 8월 16일
Alternatively you can just copy the old axes and paste it over:
new = copyobj(gca,gcf);
set(new,'YAxisLocation','right');
The linkaxes() will keep the two synchronized.
  댓글 수: 1
Jan
Jan 2019년 2월 12일
Diego López Acevedo wrote as flag: "to repeat axis on the same graph"
@Diego: Please use flags only to inform admins about content, which might conflict with the terms of use, e.g. by rudeness or spam. Thanks.

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

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by