Marker shape (take 'o') not as expected at large (50) linewidths and markersize (50)?

2 次查看(过去 30 天)
Running this:
x=0:2:10;
y=x.^2;
p=plot(x,y,'LineWidth',50,'Marker','o','MarkerSize',50,...
'MarkerEdgeColor','b','MarkerFaceColor',[0.5,0.5,0.5]);
leads to:
Markers can be seen to be rather '+' than 'o'. I have similar problems with most other markers. Any help to resolve this is appreciated.
Thanks!

回答(1 个)

Walter Roberson
Walter Roberson 2016-3-21
In R2014a on OS-X, I do not see the marker as a plus, but I do see it as a distorted circle. With additional testing, I see that the LineWidth is being applied to creating the Marker as well.
Work-Around: plot() once without markers but with the LineWidth desired for the line. plot() a second time with the desired marker and with no LineWidth and with LineStyle 'none', to draw the markers properly.
  3 个评论
Walter Roberson
Walter Roberson 2016-3-21
MarkerSize 50 means 50 square points, so for a square that would be about 7 points x 7 points. LineWidth 50 means 50 points wide, so 25 points from the center to the edge. Draw two lines with their centers about 7 points part and each line 50 points wide. The result is not going to look anything like you had hoped.
So you can have thick borders, but they will need to be a lot thinner than the line width, probably notably less than 1/2 of sqrt() of the marker size. Each individual straight line of the marker (including curves approximated as straight lines) is drawn as an individual brush stroke with straight edges. That produces spikes -- the strokes are not chamfered.
scatter() has a 'fill' option, by the way, if your aim is to fill the markers. Or Use a marker edge color the same as the marker face color as requesting a marker face coloring means you want filling.
Bram Veenhuizen
Bram Veenhuizen 2016-3-22
Thanks for your reply, Walter. I will do this plotting job in excel which produces proper thick-edged markers as well as chamfering out of the box.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 2-D and 3-D Plots 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by