Why are tick marks only on one axis when I change the tick spacing?

3 ビュー (過去 30 日間)
Raven
Raven 2023 年 1 月 25 日
コメント済み: Les Beckham 2023 年 1 月 26 日
I am making a plot in MATLAB, and I want to specify the spacing of tick marks and grid lines.
By default, I get something like this:
But I want both the x and y axes to have have lines with a spacing of 1. So I changed the code to this:
axis equal;
xticks(1:1:5);
yticks(1:1:5);
grid on;
However, this causes the graph to look like this:
Notably, the horizontal grid lines and y-axis tick marks and labels are entirely gone. I have no clue why this would be. This seems like something that should be very straightforward, so not sure where the error could be coming in. Any help would be greatly appreciated. Thanks.

採用された回答

Les Beckham
Les Beckham 2023 年 1 月 25 日
Try
yticks(-4:0)
  3 件のコメント
Raven
Raven 2023 年 1 月 26 日
編集済み: Raven 2023 年 1 月 26 日
Welp, that was pretty straightforward. Not sure how I missed that, but thanks.
Les Beckham
Les Beckham 2023 年 1 月 26 日
You are quite welcome.

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

その他の回答 (0 件)

カテゴリ

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

タグ

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by