You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: Markers with numeric name like CARETLEFT cannot be specified using a cycler #27596
I want to cycle between multiple markerstyles, including those with a numeric value like CARETRIGHT as documented here, but I get an exception if I add one of those.
Traceback (most recent call last):
File "/home/mcd/bugs/bug-cycler.py", line 11, in <module>
plt.rc('axes', prop_cycle=cycle)
File "/usr/lib/python3.11/site-packages/matplotlib/pyplot.py", line 670, in rc
matplotlib.rc(group, **kwargs)
File "/usr/lib/python3.11/site-packages/matplotlib/__init__.py", line 1062, in rc
rcParams[key] = v
~~~~~~~~^^^^^
File "/usr/lib/python3.11/site-packages/matplotlib/__init__.py", line 734, in __setitem__
raise ValueError(f"Key {key}: {ve}") from None
ValueError: Key axes.prop_cycle: Could not convert 5 to str
Expected outcome
A plot using CARETLEFT as marker.
Additional information
This seems like it has to do with the fact, that some markers are referred to by number and not by a string like "+".
I don't know whether the problem is in matplotlib, cycler or the combination of both.
Looks like the validator for the `marker` property is a stringlist
validator, so it is trying to coerce things into strings. Probably should
update the validator.
On Wed, Jan 3, 2024 at 1:06 PM castilma ***@***.***> wrote:
Bug summary
I want to cycle between multiple markerstyles, including those with a
numeric value like CARETRIGHT as documented here
<https://matplotlib.org/stable/api/markers_api.html#module-matplotlib.markers>,
but I get an exception if I add one of those.
Code for reproduction
#!/usr/bin/env python3
from cycler import cyclerimport matplotlib.pyplot as pltimport matplotlib.markers as mk
cycle = cycler(marker=["+",mk.CARETRIGHT])
t=[0,1]y=[5,6]
plt.rc('axes', prop_cycle=cycle)plt.plot(t,y)plt.show()
Actual outcome
Traceback (most recent call last):
File "/home/mcd/bugs/bug-cycler.py", line 11, in <module>
plt.rc('axes', prop_cycle=cycle)
File "/usr/lib/python3.11/site-packages/matplotlib/pyplot.py", line 670, in rc
matplotlib.rc(group, **kwargs)
File "/usr/lib/python3.11/site-packages/matplotlib/__init__.py", line 1062, in rc
rcParams[key] = v
~~~~~~~~^^^^^
File "/usr/lib/python3.11/site-packages/matplotlib/__init__.py", line 734, in __setitem__
raise ValueError(f"Key {key}: {ve}") from None
ValueError: Key axes.prop_cycle: Could not convert 5 to str
Expected outcome
A plot using CARETLEFT as marker.
Additional information
This seems like it has to do with the fact, that some markers are referred
to by number and not by a string like "+".
I don't know whether the problem is in matplotlib, cycler or the
combination of both.
Operating system
Artix Linux
Matplotlib Version
3.8.1
Matplotlib Backend
GTK4Agg
Python version
Python 3.11.6
Jupyter version
*No response*
Installation
Linux package manager
—
Reply to this email directly, view it on GitHub
<#27596>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACHF6ELTISA2WV6D5ACXBLYMWM3TAVCNFSM6AAAAABBLZNEFCVHI2DSMVQWIX3LMV43ASLTON2WKOZSGA3DINBUGUZTKOI>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
This issue is suited to new contributors because it does not require understanding of the Matplotlib internals. To get started, please see our contributing guide.
We do not assign issues. Check the Development section in the sidebar for linked pull requests (PRs). If there are none, feel free to start working on it. If there is an open PR, please collaborate on the work by reviewing it rather than duplicating it in a competing PR.
update the marker validator to accept all valid marker specifications (atleast the integers, maybe the path and Marker classes as well)
add a test
add a whats new (if extended past integers)
Good first issue because this is very narrowly scoped, but medium because there is some meta-programming in the validator code. Some thought will need to be given to writing a validator that works for both "live" objects and for strings coming from reading and .matplotlibrc.
On Wed, Jan 3, 2024 at 1:38 PM Thomas A Caswell ***@***.***> wrote:
Steps:
- update the marker validator to accept all valid marker
specifications (atleast the integers, maybe the path and Marker
classes as well)
- add a test
- add a whats new (if extended past integers)
Good first issue because this is very narrowly scoped, but medium because
there is some meta-programming in the validator code. Some thought will
need to be given to writing a validator that works for both "live" objects
and for strings coming from reading and .matplotlibrc.
—
Reply to this email directly, view it on GitHub
<#27596 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACHF6GY7VSBKB7VZ77OGN3YMWQTFAVCNFSM6AAAAABBLZNEFCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZVHAYDCOJXGE>
.
You are receiving this because you commented.Message ID:
***@***.***>
Activity
WeatherGod commentedon Jan 3, 2024
tacaswell commentedon Jan 3, 2024
More specifically
matplotlib/lib/matplotlib/rcsetup.py
Line 648 in 8703dc5
is a simpler way exercise the same issue.
github-actions commentedon Jan 3, 2024
Good first issue - notes for new contributors
This issue is suited to new contributors because it does not require understanding of the Matplotlib internals. To get started, please see our contributing guide.
We do not assign issues. Check the Development section in the sidebar for linked pull requests (PRs). If there are none, feel free to start working on it. If there is an open PR, please collaborate on the work by reviewing it rather than duplicating it in a competing PR.
If something is unclear, please reach out on any of our communication channels.
tacaswell commentedon Jan 3, 2024
Steps:
Markerclasses as well)Good first issue because this is very narrowly scoped, but medium because there is some meta-programming in the validator code. Some thought will need to be given to writing a validator that works for both "live" objects and for strings coming from reading and .matplotlibrc.
WeatherGod commentedon Jan 3, 2024