-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Setting the plot backend should validate .plot
immediately
#28163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Labels
Visualization
plotting
Milestone
Comments
TomAugspurger
added a commit
to TomAugspurger/pandas
that referenced
this issue
Aug 27, 2019
```python In [1]: import pandas as pd In [2]: import sys In [3]: import types In [4]: module = types.ModuleType("foo") In [5]: sys.modules['foo'] = module In [6]: pd.set_option('plotting.backend', 'foo') --------------------------------------------------------------------------- ValueError Traceback (most recent call last) <ipython-input-6-123b6513deb2> in <module> ----> 1 pd.set_option('plotting.backend', 'foo') ... ~/sandbox/pandas/pandas/plotting/_core.py in _find_backend(backend) 1588 "top-level `.plot` method." 1589 ) -> 1590 raise ValueError(msg.format(name=backend)) 1591 1592 ValueError: Could not find plotting backend 'foo'. Ensure that you've installed the package providing the 'foo' entrypoint, or that the package has atop-level `.plot` method. ``` Closes pandas-dev#28163
Makes sense to me, but I think it's trickier than it looks. My first implementation had some validations when setting the backend, but iirc @jreback preference was to not import the module until a plot is called. I think because matplotlib needs to be loaded even if plot() is never used, unless some hacky things are done. |
TomAugspurger
added a commit
that referenced
this issue
Sep 3, 2019
* Validate plot backend when setting. Closes #28163
proost
pushed a commit
to proost/pandas
that referenced
this issue
Dec 19, 2019
* Validate plot backend when setting. Closes pandas-dev#28163
proost
pushed a commit
to proost/pandas
that referenced
this issue
Dec 19, 2019
* Validate plot backend when setting. Closes pandas-dev#28163
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Right now a
pd.set_option('display.backend', name)
willname
and setting that to the backendIn the second case, the backend's implementation isn't validated until a plot is actually requested. We should validate that
name.plot
is a thing when the backend is set.Rather than raising an
AttributeError
ondf.plot
, we should raise aValueError
onpd.set_option('plotting.backend', 'foo')
.The text was updated successfully, but these errors were encountered: