Matlab produces empty figure when using plot(x,y,'-')
Afficher commentaires plus anciens
Hi, I have a code that works fine, its meant to plot time t over a variable A. the plot function works when i specify plot(t,A,'*'), but produces an empty figure when i use any other marker ( for example using 'o' or '-' will produce an empty figure), and when I dont specify a marker. I am on MacOS version 12.1.
example: this conde works and produces a graph
A = 20
t = 0
while t < 20
A = A + 1
t = t + 1
plot(t,A,'*')
hold on
end
however this:
A = 20
t = 0
while t < 20
A = A + 1
t = t + 5
plot(t,A,'-')
hold on
end
creats an empty figure.
1 commentaire
Walter Roberson
le 1 Avr 2022
'-' is not a marker: it is a plot line style.
I would, though, expect 'o' to work as a marker.
Réponse acceptée
Plus de réponses (1)
A = 20
Ap = A;
t = 0
tp = t;
while t < 20
A = A + 1
Ap = [Ap, A];
t = t + 5
tp = [tp, t];
end
figure
plot(tp, Ap, '-')
1 commentaire
Mia DeCataldo
le 2 Avr 2022
Catégories
En savoir plus sur Creating, Deleting, and Querying Graphics Objects dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

