set the Ticks only on the X and Y axis

4 ビュー (過去 30 日間)
boureghda mohammed
boureghda mohammed 2017 年 4 月 14 日
コメント済み: Star Strider 2017 年 4 月 15 日
How can I set the Ticks only on the X and Y axis as shown in the following image:

採用された回答

Star Strider
Star Strider 2017 年 4 月 14 日
Set the axis box to 'off'.
Example
x = 0:20;
y = sin(x*pi/9);
figure(1)
plot(x, y);
grid
ha = gca;
ha.Box = 'off';
See if that does what you want to do.
See the documentation for Axes Properties (link) for details.
  2 件のコメント
boureghda mohammed
boureghda mohammed 2017 年 4 月 15 日
編集済み: boureghda mohammed 2017 年 4 月 15 日
Star Strider, I want to delete only the Ticks with conserving the line.
Star Strider
Star Strider 2017 年 4 月 15 日
if you want the lines but not the ticks, you have to plot each of them separately as lines:
x = 0:20;
y = sin(x*pi/9);
figure(1)
plot(x, y);
hold on
plot(xlim, [1 1]*max(ylim), '-k') % Top Box Limit Without Ticks
plot([1 1]*max(xlim), ylim, '-k') % Right Box Limit Without Ticks
hold off
grid
hax = gca;
hax.Box = 'off';

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGrid Lines, Tick Values, and Labels についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by