Ah, I see. Once I changed my marker size to 30, the circles appeared. It is still kinda odd that when I used "MarkerFaceColor" with a size 20, I still got circle markers, but with "filled" they appear to be square. I wonder if "filled" changes the marker size or something along those lines.
Scatter plot changes markers when using 'filled' option
69 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
njj1
el 10 de Feb. de 2020
I am using scatter plot and for some reason when I use the "filled" option, the marker shapes change to squares. Here is an example of my code:
scatter(T{:,i},height(T):-1:1,20, 'filled')
In this case, I am just plotting the entries for a particular table column, T{:,i}, against the row numbers. When I execute this code, the marker shapes are squares. However, if I use the longer form, I get filled circles:
scatter(T{:,i},height(T):-1:1,20, 'MarkerFaceColor', lines(1))
The drag here is that I have to know which color I am using rather than simply having the markers automatically filled with the matching color. Has anyone else ever experienced this?
2 comentarios
Respuesta aceptada
Adam Danz
el 10 de Feb. de 2020
Editada: Adam Danz
el 10 de Feb. de 2020
The shape of "filled" scatter points aren't necessarily changing to a square, although at some marker sizes it does appear to be a square. Change the SizeData property and you'll see that "filled" markers change shape. The marker size for scatter points specify the marker area in points squared which may partially explain the lack of consistency in shape. Monitor resolution may also factor in.
The reason the markers may appear less rigid when MarkerFaceColor is applied is because the marker edges are also applied and they smooth out the rigidity.
This demo below compare 5 scatter point sizes across the three conditions. You'll notice that the "filled" and the "MarkerFaceColor without edges" appear the same.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/270884/image.png)
% Reproduce the plot above.
clf()
hold on
markerSizes = 20:20:100;
scatter(1:5, ones(1,5)+2, markerSizes, 'b', 'filled')
scatter(1:5, ones(1,5)+1, markerSizes, 'MarkerFaceColor', 'b')
scatter(1:5, ones(1,5)+0, markerSizes, 'MarkerFaceColor', 'b','MarkerEdgeColor', 'none')
xlim([-4, 10])
ylim([-4,8])
% use FEX function: https://www.mathworks.com/matlabcentral/fileexchange/46891-labelpoints
labelpoints(1:5, ones(1,5)+2, markerSizes, 'N', 0.1)
labelpoints(1, [3,2,1], {'filled','MarkerFaceColor', 'MarkerfaceColor w/o edges'}, 'W', 0.2)
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Scatter Plots en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!