Explain the markersize in Axes() in detail

In Matplotlib, markersizethe parameters of the Axes object refer to the parameters of the size of the marker (such as the point in the scatter diagram) in the drawing graph. This parameter specifies the length of the marker's diameter in pixels or points (pt). Specifically, it controls the size of the marker in the x-axis and y-axis direction, so when drawing, it will be scaled according to the position of the data point in the coordinate system.

For example, when using the functions in the Matplotlib library scatter()to draw a two-dimensional scatter plot, you can markersizechange the size of the scatter points by setting parameters. For example, the following code will draw red circular dots, each 20 pixels in size:

import matplotlib.pyplot as plt

x = [1, 2, 3, 4, 5]
y = [10, 8, 6, 4, 2]

plt.scatter(x, y, c='red', marker='o', s=20)
plt.show()

operation result:

 

Guess you like

Origin blog.csdn.net/qq_45138078/article/details/129856355