Query about axes of graph created by plot function
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Erika Yoshikawa
le 9 Fév 2021
Commenté : Star Strider
le 10 Fév 2021
If I have two variables A = [1 2 3] and B = [1 2 3], when I plot(A,B) I get a graph with 10 variables on both x and y axis with constant intervals between 1 and 3.
Is there a way where I can just get a graph with 3 values 1, 2 and 3 on both x and y axis?
0 commentaires
Réponse acceptée
Star Strider
le 9 Fév 2021
I am not certain what the original problem is with your plot.
Try this:
A = [1 2 3];
B = [1 2 3];
figure
plot(A, B)
Ax = gca;
Ax.XTick = A;
Ax.YTick = B;
.
2 commentaires
Plus de réponses (1)
Walter Roberson
le 9 Fév 2021
I suspect that you want to use xlim() and ylim()
2 commentaires
Walter Roberson
le 9 Fév 2021
MATLAB automatically chooses "nice" ticks. You can use xticks() and yticks() to choose different tick locations.
Voir également
Catégories
En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!