How can I make right axis off in Matlab plot?

Hi all,
I want to show only top, bottom and left axis of my plot, by hiding right axis ? How can I do that ?can You please help me? I tried the codes below one of them resulted both y axis off and another gave the error!!
thank you
set(gca,'YColor','none')
set(gca,'rightYColor','none')

 채택된 답변

Simon Chan
Simon Chan 2022년 1월 23일

1 개 추천

Use function yyaxis and hide the right y-axis as follows:
clear; clc;
h = figure(1);
hax = axes;
y=randi(100,1,10);
grid on;
yyaxis(hax,'left');
plot(1:10,y)
yyaxis(hax,'right');
hax.YAxis(2).Visible='off';

추가 답변 (0개)

카테고리

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

질문:

2022년 1월 22일

답변:

2022년 1월 23일

Community Treasure Hunt

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

Start Hunting!

Translated by