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

2 Ansichten (letzte 30 Tage)
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!

Antworten (1)

Walter Roberson
Walter Roberson am 21 Mär. 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 Kommentare
Walter Roberson
Walter Roberson am 21 Mär. 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.
Bram Veenhuizen
Bram Veenhuizen am 22 Mär. 2016
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.

Melden Sie sich an, um zu kommentieren.

Kategorien

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

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by