Matlab produces empty figure when using plot(x,y,'-')
Ältere Kommentare anzeigen
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 Kommentar
Walter Roberson
am 1 Apr. 2022
'-' is not a marker: it is a plot line style.
I would, though, expect 'o' to work as a marker.
Akzeptierte Antwort
Weitere Antworten (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 Kommentar
Mia DeCataldo
am 2 Apr. 2022
Kategorien
Mehr zu Creating, Deleting, and Querying Graphics Objects finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

