Marker shape (take 'o') not as expected at large (50) linewidths and markersize (50)?
2 views (last 30 days)
Show older comments
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 Comment
Answers (1)
Walter Roberson
on 21 Mar 2016
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 Comments
Walter Roberson
on 21 Mar 2016
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.
See Also
Categories
Find more on 2-D and 3-D Plots in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!