フィルターのクリア

Modify code for tick marks to be on the outside?

399 ビュー (過去 30 日間)
Jai
Jai 2014 年 8 月 14 日
コメント済み: Paul Wintz 2023 年 9 月 8 日
Hi all,
I copied and pasted this code...I just need a slight modification to get the tick marks to appear on the outside and not on the side of the graph. It is currently set to only have the tick marks on the bottom (x axis) and the left (y axis). I.e. not at the right and at the top.
axis([0,1200,0,70])
% get handle to current axes
a = gca;
% set box property to off and remove background color
set(a,'box','off','color','none')
% create new, empty axes with box but without ticks
b = axes('Position',get(a,'Position'),'box','on','xtick',[],'ytick',[]);
% set original axes as active
axes(a)
% link axes in case of zooming
linkaxes([a b])
Many thanks.
J

採用された回答

William Frane
William Frane 2014 年 8 月 14 日
Tick direction is controlled using the TickDir property.
set(gca,'TickDir','out'); % The only other option is 'in'
For reference, a complete list of axes properties is available here.
Hope that helps.
  4 件のコメント
银雀Sparr0w
银雀Sparr0w 2023 年 5 月 15 日
編集済み: 银雀Sparr0w 2023 年 5 月 15 日
No, there is one more option that is 'both'. Actually after R2021b we've got another one 'none'.
Paul Wintz
Paul Wintz 2023 年 9 月 8 日
The link to Axes Properties is broken. Here's a new link: Axes Properties.

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

その他の回答 (1 件)

Jai
Jai 2014 年 8 月 14 日
Thank you for your help. It worked perfectly!

カテゴリ

Help Center および File ExchangeAnnotations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by