Question

I have a system of finite size circular particles (say r=5cm) which I need to plot in a given domain (say L=5m). Since they are many, scatter is faster than any cyclic use of rectangle.

What is unclear to me is the correct way to define the diameter/radius of the circles/marker so to scale correctly with the domain geometry which is plotted as well. (By using rectangle, the diameter of the particle can be easily defined.)

Based on this answer, it is possible to have fine control of the marker size, although the real scaling is obscure to me.

Can anyone shed some light?

Was it helpful?

Solution 2

The official documentation states:

MarkerSize
Marker size. Size of the marker in points. The default value is 6.

Note that one point is 1/72 of an inch, so it's an absolute measurement unit.

If you want to tune the marker sizes according to the axis scale of your plot, do a simple unit conversion: calibrate 1 tick in one of the axes to points (you can do it by trial and error), and then normalize all your marker sizes by it (it doesn't, however, occur to me how you'd keep the marker sizes relative to the plot's zoom level in a straightforward manner).

By the way, you can specify the sizes of the markers directly as the third parameter in the scatter command. With this, you can avoid the get and set manipulations mentioned in the answer to which have linked your question.

OTHER TIPS

The SCATTER function expects its 'S' parameter to contain the marker area in points squared. This area corresponds to the area of a square bounding box around the marker.

The source is the technical solution "How do I specify the size of the markers created by the SCATTER plot in units proportional to the data being plotted in MATLAB 7.6 (R2008a)?"

Check out the code in the link.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top