Need Help!!!! How Can I Label the y axis on the right side? I did it and it still does not appears on right side of the graph
147 ビュー (過去 30 日間)
古いコメントを表示
This is part of the code I have been working on:
if true
% codetitle('Moody Chart')
xlabel('Reynolds number Re')
ylabel('f')
yyaxis right
set(gca,'yscale','log','YTick',[0.00001 0.00002 0.0001 0.0002:0.0002:0.001 0.002:002:0.01 0.015 0.02:0.01:0.05]);
ylabel({'Relative Roughness'; 'e/D'})
grid on
end
It came out like this, there is not y axis labels on the right side

As opposed to this

0 件のコメント
回答 (2 件)
Hamid Oral
2022 年 1 月 14 日
You can see the properties of a plot with the following command:
>get(gca)
...
YAxisLocation: 'left'
...
You will have a list of properties on the screen. You can pick and choose the one you would like to change and do it as follows:
>set(gca,'YAxisLocation','right')
This way you would be placing the Y axis on the right side, while the default is left
0 件のコメント
Paola Faoro
2020 年 12 月 16 日
編集済み: Paola Faoro
2020 年 12 月 16 日
Hi Kim
I can see that both the y axis label ‘Relative Roughness e/D’ and the yticks appear at the right of your plot, so I’m assuming you would like to see the yticklabels on the right as well.
For that you can use the yticks and yticklabels commands as shown below, and adjust the values to match your need.
if true
% codetitle('Moody Chart')
xlabel('Reynolds number Re')
ylabel('f')
yyaxis right
% set(gca,'yscale','log','YTick',[0.00001 0.00002 0.0001 0.0002:0.0002:0.001 0.002:002:0.01 0.015 0.02:0.01:0.05]);
ylabel({'Relative Roughness'; 'e/D'})
yticks([0.1 0.5 1])
yticklabels ({'y=0', 'y=0.5', 'y=1'})
grid on
end
Here are some doc pages that may be useful to refer to:
Best,
Paola
0 件のコメント
参考
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!