In Matplotlib, marker
the parameters of the Axes object refer to the shape of the marker (such as the point in the scatter plot) in the drawing graph. It can be a string or special characters, for example:
'.'
: dots','
: pixel'o'
: round'v'
: lower triangle'^'
: upper triangle'<'
: left triangle'>'
: right triangle'1'
: play tricks'2'
: Shanghuaxin'3'
: left hand'4'
: right flower heart's'
: square'p'
: pentagon'*'
: star'h'
: hexagon 1'H'
: Hexagon 2'+'
: Cross'x'
: x shape'D'
: rhombus'd'
: narrow rhombus
For example, when using the functions in the Matplotlib library scatter()
to draw a two-dimensional scatter plot, you can marker
change the shape of the scatter by setting parameters. For example, the following code will draw red star points:
import matplotlib.pyplot as plt
x = [1, 2, 3, 4, 5]
y = [10, 8, 6, 4, 2]
plt.scatter(x, y, c='red', marker='*', s=50)
plt.show()
operation result: