Filter löschen
Filter löschen

how to plot line with dots?

163 Ansichten (letzte 30 Tage)
Ararat Cetinkaya
Ararat Cetinkaya am 24 Mai 2020
Kommentiert: Star Strider am 24 Mai 2020
I have a two matrix X and Y. I want to make a line graph with dots with plot function.
plot (x,y,'--ok');
it is just plotting black circles but ı want to plot line too with circles.

Akzeptierte Antwort

Star Strider
Star Strider am 24 Mai 2020
There are several options:
x = 1:10;
y = rand(1,10);
subplot(3,1,1)
plot(x, y, '-ok')
title('Circles and Lines')
subplot(3,1,2)
plot(x, y, 'ok', 'MarkerFaceColor','k')
title('Filled Circles')
subplot(3,1,3)
plot(x, y, '.k')
title('Dots')
One of those (or a combination of them) should do what you want.
.
  2 Kommentare
Ararat Cetinkaya
Ararat Cetinkaya am 24 Mai 2020
I guess plot(x, y, '-ok') this one is not working in while loop with hold on .
Star Strider
Star Strider am 24 Mai 2020
If you are plotting individual points in a loop, it is not possible to plot lines connecting them, since that is only possible when plotting two or more points. It is necessary to save the data as a vector, and then plot it after the loop completes.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by