"AttributeError: unexpected attribute 'plot_width' to figure, similar attributes are outer_width, width or min_width " with pandas_bokeh

9.3k views Asked by At

I am trying to use pandas_bokeh to create a line graph with a pandas dataframe I call bucketed_df

import pandas_bokeh
pandas_bokeh.output_notebook()

bucketed_df.plot_bokeh(kind='line')

for some reason I get the error

AttributeError: unexpected attribute 'plot_width' to figure, similar attributes are outer_width, width or min_width

Im not sure what this is or how toi fix it. I am using python 3.9 and jupyter notebooks

I have a matplotlib linegraph in a cell above it. I am thinking there could be some issue with that.

Also if anyone knows any interactive graphs that are better I am open to switching to a different library.

5

There are 5 answers

1
beep_check On

I'm getting a similar error on a recent install of bokeh==3.0.1.

The error goes away if I install version 2.4.3 (last release) with pip install --upgrade bokeh==2.4.3

It seems there was a breaking change in 3.0.0 that hasn't been addressed yet. If you have time, post this issue at https://github.com/bokeh/bokeh/issues.

1
Bobby On

temp way:

File ".../lib/python3.10/site-packages/pandas_bokeh/plot.py", line 439, in plot

Add

figure_options['width'] = figure_options['plot_width']
figure_options['height'] = figure_options['plot_height']
del figure_options['plot_width']
del figure_options['plot_height']
1
user3248647 On

can be done like

p=figure(min_width=500, height=500)

or simply,

p=figure(width=500, height=500)

this may help.

0
francoua On

The error has been reported in the GitHub of pandas_bokeh : https://github.com/PatrikHlobil/Pandas-Bokeh/issues/128 But unfortunately, no solution has been found yet, except for someone using the latest commit of the github... For what it's worth.

1
ZHar On

this temp way works but you must change file ".../lib/python3.10/site-packages/pandas_bokeh/geoplot.py" not plot.py