Matlab produces empty figure when using plot(x,y,'-')
Mostra commenti meno recenti
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 Commento
Walter Roberson
il 1 Apr 2022
'-' is not a marker: it is a plot line style.
I would, though, expect 'o' to work as a marker.
Risposta accettata
Più risposte (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 Commento
Mia DeCataldo
il 2 Apr 2022
Categorie
Scopri di più su Creating, Deleting, and Querying Graphics Objects in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

