![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/870525/image.jpeg)
How can I make right axis off in Matlab plot?
83 次查看(过去 30 天)
显示 更早的评论
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')
0 个评论
采纳的回答
Simon Chan
2022-1-23
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';
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/870525/image.jpeg)
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Annotations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!