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.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Axis Labels에 대해 자세히 알아보기

태그

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by