'Python / Bokeh / Pandas AttributeError: unexpected attribute 'responsive' to Figure

I'm trying to use bokeh and pandas to create a graph. If ", responsive = True" is not included, the code works. If it is included, it doesn't work. Any suggestions for what I'm doing wrong? Thanks!

from bokeh.plotting import Figure, output_file, show
import pandas

file="adbe.csv"

df=pandas.read_csv(file, parse_dates=["Date"])

p=figure(width=500, height=500, x_axis_type="datetime", responsive = True)

p.line(df["Date"],df["Close"],color="Orange", alpha=0.5)

output_file("Time_Series.html")
show(p)

Here's the full error message: AttributeError Traceback (most recent call last) in 6 df=pandas.read_csv(file, parse_dates=["Date"]) 7 ----> 8 p=figure(width=500, height=500, x_axis_type="datetime", responsive = True) 9 10 p.line(df["Date"],df["Close"],color="Orange", alpha=0.5)

c:\users\jason\appdata\local\programs\python\python37\lib\site-packages\bokeh\plotting\figure.py in figure(**kwargs)
   1530 
   1531 def figure(**kwargs):
-> 1532     return Figure(**kwargs)
   1533 figure.__doc__ = Figure.__doc__
   1534 

c:\users\jason\appdata\local\programs\python\python37\lib\site-packages\bokeh\plotting\figure.py in __init__(self, *arg, **kw)
    163             kw['title'] = Title(text=title)
    164 
--> 165         super().__init__(*arg, **kw)
    166 
    167         self.x_range = get_range(opts.x_range)

c:\users\jason\appdata\local\programs\python\python37\lib\site-packages\bokeh\model.py in __init__(self, **kwargs)
    232         kwargs.pop("id", None)
    233 
--> 234         super().__init__(**kwargs)
    235         default_theme.apply_to_model(self)
    236 

c:\users\jason\appdata\local\programs\python\python37\lib\site-packages\bokeh\core\has_props.py in __init__(self, **properties)
    245 
    246         for name, value in properties.items():
--> 247             setattr(self, name, value)
    248 
    249     def __setattr__(self, name, value):

c:\users\jason\appdata\local\programs\python\python37\lib\site-packages\bokeh\core\has_props.py in __setattr__(self, name, value)
    280 
    281             raise AttributeError("unexpected attribute '%s' to %s, %s attributes are %s" %
--> 282                 (name, self.__class__.__name__, text, nice_join(matches)))
    283 
    284     def __str__(self):

AttributeError: unexpected attribute 'responsive' to Figure, possible attributes are above, align, aspect_ratio, aspect_scale, background, background_fill_alpha, background_fill_color, below, border_fill_alpha, border_fill_color, center, css_classes, disabled, extra_x_ranges, extra_y_ranges, frame_height, frame_width, height, height_policy, hidpi, inner_height, inner_width, js_event_callbacks, js_property_callbacks, left, lod_factor, lod_interval, lod_threshold, lod_timeout, margin, match_aspect, max_height, max_width, min_border, min_border_bottom, min_border_left, min_border_right, min_border_top, min_height, min_width, name, outer_height, outer_width, outline_line_alpha, outline_line_cap, outline_line_color, outline_line_dash, outline_line_dash_offset, outline_line_join, outline_line_width, output_backend, plot_height, plot_width, renderers, reset_policy, right, sizing_mode, subscribed_events, tags, title, title_location, toolbar, toolbar_location, toolbar_sticky, visible, width, width_policy, x_range, x_scale, y_range or y_scale


Solution 1:[1]

Like the error said, Figure has not attribute 'responsive', so, don't use it.

You can check the documentation

Solution 2:[2]

Are you doing Ardit Sulce's tutorial? Because I stumbled upoh the same issue. I looked that up and found more explanation on this at https://github.com/bokeh/bokeh/issues/4620 I managed to get the similar output to responsive = True by using sizing_mode = "scale_width"

I hope this helps others who stumbled upon the same issue while following the tutorial.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Ricardo Rendich
Solution 2 fromwindowstolinux