Plotting connected dots with two different colors (One for the dots and one for the lines)
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Vingt100
am 26 Mai 2020
Kommentiert: Vingt100
am 26 Mai 2020
Hello everyone,
So I guess that my problem is well explained in the title. I want to chage the color of the dots but not the one of the lines that connect the dots.
Here is the line that plots this figure :
plot(x,y,'o-r','Linewidth',3)
Thanks you in advance for your answers.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/301408/image.png)
0 Kommentare
Akzeptierte Antwort
Johannes Hougaard
am 26 Mai 2020
It is the 'MarkerEdgeColor' and 'MarkerFaceColor' properties.
data = randn(4,1)*3;
figure;
p = plot(data,'-','color',[0.7 0 0.7],'LineWidth',3,...
'Marker','o','MarkerEdgeColor',[0.7 0.7 0],'MarkerFaceColor',[0 0.7 0.7]);
I've added an outputhandle for the line, that makes it easier to change the properties afterwards.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Annotations finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!