フィルターのクリア

How to set axis in more details?

2 ビュー (過去 30 日間)
qilin guo
qilin guo 2021 年 11 月 1 日
コメント済み: qilin guo 2021 年 11 月 2 日
Dear all,
I want to know if it is possible to set YTickDir = "out" and keep the yticks on the left y axis only. (As far as I know, there no such properties name "YTickDir" for axes.) In my case, I don't know how to remove the ticks of right yaxis.
It cannot be better if I could set XTickDir and YTickDir separately, just like xmgrace. Actually I woud use MATLAB to replace xmgrace to plot as I can use scripts to control my plots, which is very convenient. I hope that the MathWorks Team would hear my voice to provide more properties to control figure. I know there are hidden properties but I don't know where I can find them.
Best regards,
Qilin.
x = linspace(0.0, 12.0, 21);
J0 = besselj(0, x);
figure; plot( x, J0, 'ro-' );
h = gca;
h.TickDir = 'out'
(In xmgrace, I can set the ticks on x or y axis drawn on "Normal side", "Opposite side" or "Both side").

採用された回答

Cris LaPierre
Cris LaPierre 2021 年 11 月 1 日
x = linspace(0.0, 12.0, 21);
J0 = besselj(0, x);
figure;
plot( x, J0, 'ro-' );
h = gca;
yax = h.YAxis; % xax = get(ax,'XAxis');
set(yax,'TickDirection','out')
box 'off'
  3 件のコメント
Cris LaPierre
Cris LaPierre 2021 年 11 月 2 日
Not that I am aware of (see this link). A work around may be to use the xline and yline functions to complete the box.
x = linspace(0.0, 12.0, 21);
J0 = besselj(0, x);
figure;
plot( x, J0, 'ro-' );
h = gca;
yax = h.YAxis; % xax = get(ax,'XAxis');
set(yax,'TickDirection','out')
box 'off'
xline(max(h.XAxis.Limits))
yline(max(h.YAxis.Limits))
qilin guo
qilin guo 2021 年 11 月 2 日
Dear Cris LaPierre, thank you very much! It looks very well. Unfortunately, I am using MATLAB R2018a, while xline and yline function are Introduced in R2018b. But I know how to work work around this quetion now. Thank you again.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeIntroduction to Installation and Licensing についてさらに検索

タグ

製品


リリース

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by