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?
So far the answer to what the size of a scatter marker means is given in units of points. Points are often used in typography, where fonts are specified in points. Also linewidths is often specified in points. The standard size of points in matplotlib is 72 points per inch (ppi) - 1 point is hence 1/72 inches.
The points in the scatter plot are by default small if the optional parameters in the syntax are not used. The optional parameter 's' is used to increase the size of scatter points in matplotlib.
plt. plot(data1, data2, marker = "." ) Output: Example 2: To adjust the size of marker in a plot use markersize parameter to plot method to adjust the marker size.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With