Matplotlib Markers Module in Python
The Matplotlib.markers module provides functions to handle markers in Matplotlib. It is used both by the marker functionality of the plot and scatter.
Below is the table defining all possible markers in Matplotlib:
Marker | Description |
---|---|
β.β | point |
β, β | pixel |
βoβ | circle |
βvβ | triangle_down |
β^β | triangle_up |
β<β | triangle_left |
β>β | triangle_right |
β1β | tri_down |
β2β | tri_up |
β3β | tri_left |
β4β | tri_right |
β8β | octagon |
βsβ | square |
βpβ | pentagon |
βPβ | plus (filled) |
β*β | star |
βhβ | hexagon1 |
βHβ | hexagon2 |
β+β | plus |
βxβ | x |
βXβ | x (filled) |
βDβ | diamond |
βdβ | thin_diamond |
β|β | vline |
β_β | hline |
0 (TICKLEFT) | tickleft |
1 (TICKRIGHT) | tickright |
2 (TICKUP) | tickup |
3 (TICKDOWN) | tickdown |
4 (CARETLEFT) | caretleft |
5 (CARETRIGHT) | caretright |
6 (CARETUP) | caretup |
7 (CARETDOWN) | caretdown |
8 (CARETLEFTBASE) | caretleft (centered at base) |
9 (CARETRIGHTBASE) | caretright (centered at base) |
10 (CARETUPBASE) | caretup (centered at base) |
11 (CARETDOWNBASE) | caretdown (centered at base) |
βNoneβ, β β or ββ | nothing |
β$β¦$β | Render the string using mathtext. E.g β$r$β for marker showing the letter r. |
verts | A list of (x, y) pairs used for Path vertices. The center of the marker is located at (0, 0) and the size is normalized, such that the created path is encapsulated inside the unit cell. |
path | A Path instance |
(numsides, style, angle) | The marker can also be a tuple (numsides, style, angle), which will create a custom, regular symbol. A) numsides: the number of sides B) style: the style of the regular symbol, 0: a regular polygon 1: a star-like symbol 2: an asterisk C) angle: the angle of rotation of the symbol |
Note: It is important to note that the two lines of code below are equivalent,
# line 1
plt.plot([1, 2, 3], marker = 9)
# line 2
plt.plot([1, 2, 3], marker = matplotlib.markers.CARETRIGHTBASE)
Matplotlib.markers module in Python
Matplotlib is an amazing visualization library in Python for 2D plots of arrays. Matplotlib is a multi-platform data visualization library built on NumPy arrays and designed to work with the broader SciPy stack. The matplotlib.markers
module provides a collection of marker styles used for data visualization in Matplotlib plots. These markers represent individual data points, enhancing clarity and distinction within graphs and charts.