Plot multiple curves with filled markers
206 ビュー (過去 30 日間)
Hello, I would like to plot a series of curves in the same graphs using lines and markers, and I want that every marker is filled and with the same color than the line color.
The following code plots 3 curves with line and markers. Each curve uses the same color for markers and line, and each curve has a different color, but the markers are not filled.
I could manually enter the colors for each curve and solve the problem, like this:
... but this will be very inefficient when I have to plot many curves.
Could you please help me with a smarter solution?
Star Strider 2021 年 8 月 5 日
One approach —
x = linspace(0,10);
v = 1:5;
y = v(:)+sin(2*pi*v(:)*x);
cm = colormap(jet(size(y,1)));
for k = 1:size(y,1)
plot(x, y(k,:), '-o', 'Color',cm(k,:), 'MarkerFaceColor',cm(k,:))