Issue
The following list of markers given in the 'matplotlib.markers' documentation page are not being recognised by both plot()
and scatter()
functions.
The error message "ValueError: Unrecognized marker style <marker-style>"
is being shown.
How can I get them to work?
import numpy as np
import matplotlib.pyplot as plt
x,y = np.random.rand(10), np.random.rand(10)
plt.plot(x, y, marker='hline')
plt.scatter(x, y, marker='hline')
I am using Spyder 4.1.5, Python 3.8.1.
List of markers showing this error:
"|" 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)
Solution
The value listed in the marker
column of the link you have referenced is the value to pass into the marker=" "
parameter for the plot.
Code example marker="_"
(hline):
plt.plot(x, y, marker="_")
Code example for marker=11
(caretdown)
plt.plot(x,y, marker=11)
Yields:
Answered By - etch_45
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.