Borrar filtros
Borrar filtros

Why does the resolution become extremely bad when increasing the linewidth when using the the circle as marker.

12 visualizaciones (últimos 30 días)
As the title is conveying.
% Example
x = -pi:pi/10:pi;
y = tan(sin(x)) - sin(tan(x));
% Plot
sc = scatter(x,y,3*100);
sc.LineWidth = 10;
Why do the circles become like "plus signs" when increasing the line width instead of becoming larger circles?
How can I increas the size and line width of the marker edge in a plot or scatter plot without loosing quality?

Respuesta aceptada

Pravin Jagtap
Pravin Jagtap el 17 de Sept. de 2019
Hello Pontus,
I have tried to reproduce the steps, but it works fine in my case. I am assuming the user is using the older version of MATLAB or using older version of ‘OpenGL’ which does not support OpenGL shaders on your platform whose graphics driver has been flagged as problematic.
One possible workaround could be using the ‘painters’ renderer as shown below:
% Example
f = gcf;
f.Renderer = 'painters';
x = -pi:pi/10:pi;
y = tan(sin(x)) - sin(tan(x));
% Plot
sc = scatter(x,y,300,'o','Linewidth',10);
The above code outputs following image:
There are, however, performance implications as ‘painters’ is typically a little slower than the hardware.
For quality of image you can you appropriate markersize and linewidth and import it as EPS file.
Kind Regards

Más respuestas (1)

Walter Roberson
Walter Roberson el 17 de Sept. de 2019
OpenGL has no built-in markers. All that it has are built-in square points. Therefore in order to create the markers, MATLAB has to draw the markers as a series of short lines. When markers are drawn for scatter() plots, then each line segment is a rectangle of given thickness, centered around the line joining two vertices. With each line segment being a rectangle, when the line width is high, those rectangles stick out noticably.
If you use plot(), then plot knows how to join line segments more smoothly. It has a property LineJoin that defaults to 'round', but my investigations suggest that LineJoin is not used for markers. Some other algorithm appears to be used for the round marker for line objects.


Más información sobre Surface and Mesh 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!

Translated by