Using theme_matplotlib() fails with `'object' object has no attribute 'startswith'`
magv opened this issue · comments
Vitaly Magerya commented
Hi, all. On my machine theme_matplotlib()
consistently fails. Here's an example:
from pandas import DataFrame
from plotnine import *
theme_set(theme_matplotlib())
PLOT = (
ggplot(DataFrame([{"X":0,"Y":0},{"X":1,"Y":2}])) +
aes('X', 'Y') +
geom_point()
);
PLOT.save('test.png')
This is what I get when I run it:
Traceback (most recent call last):
File "test.py", line 11, in <module>
PLOT.save('test.png')
File ".../site-packages/plotnine/ggplot.py", line 664, in save
sv = self.save_helper(
File ".../site-packages/plotnine/ggplot.py", line 613, in save_helper
figure = self.draw(show=False)
File ".../site-packages/plotnine/ggplot.py", line 272, in draw
with plot_context(self, show=show):
File ".../site-packages/plotnine/_utils/context.py", line 48, in __enter__
self.rc_context.__enter__()
File ".../contextlib.py", line 135, in __enter__
return next(self.gen)
File ".../site-packages/matplotlib/__init__.py", line 1188, in rc_context
rcParams.update(rc)
File ".../_collections_abc.py", line 994, in update
self[key] = other[key]
File ".../site-packages/matplotlib/__init__.py", line 733, in __setitem__
cval = self.validate[key](val)
File ".../site-packages/matplotlib/rcsetup.py", line 252, in validate_backend
s if s is _auto_backend_sentinel or s.startswith("module://")
AttributeError: 'object' object has no attribute 'startswith'
This is with Python 3.10.5, matplotlib 3.8.4, and 0.13.6.
Is there anything I can do to make this work?
Hassan Kibirige commented
I cannot reproduce this. I think there is something wrong with you installation.