org-arl / arlpy

ARL Python Tools
BSD 3-Clause "New" or "Revised" License
119 stars 37 forks source link

ValueError when running with latest bokeh. #33

Closed notthetup closed 4 years ago

notthetup commented 4 years ago

plot.psd gives an error when running with bokeh 1.4.0.

Since the dep is defined as bokeh>=1.2.0 it automagically installs bokeh 1.4.0 when installing arlpy

The actual error :

BokehDeprecationWarning: 'legend' keyword is deprecated, use explicit 'legend_label', 'legend_field', or 'legend_group' keywords instead
ValueError                                Traceback (most recent call last)
<ipython-input-9-0e6f7195dc3c> in <module>
      1 calib = adcV * 10**((rxSensitivity-gain)/20)
----> 2 plt.psd(np.array(file['noise']['dut'])*calib, fs=dutfs, hold=True, color='blue', xlim=[0, 96000/2])
      3 plt.psd(np.array(file['noise']['golden'])*calib, fs=goldenfs, color='goldenrod')

~/Library/Python/3.7/lib/python/site-packages/arlpy/plot.py in psd(x, fs, nfft, noverlap, window, color, style, thickness, marker, filled, size, title, xlabel, ylabel, xlim, ylim, width, height, legend, hold, interactive)
    683     if ylim is None:
    684         ylim = (_np.max(Pxx)-50, _np.max(Pxx)+10)
--> 685     plot(f, Pxx, color=color, style=style, thickness=thickness, marker=marker, filled=filled, size=size, title=title, xlabel=xlabel, ylabel=ylabel, xlim=xlim, ylim=ylim, maxpts=len(f), width=width, height=height, hold=hold, legend=legend, interactive=interactive)
    686 
    687 def iqplot(data, marker='.', color=None, labels=None, filled=False, size=None, title=None, xlabel=None, ylabel=None, xlim=[-2, 2], ylim=[-2, 2], width=None, height=None, hold=False, interactive=None):

~/Library/Python/3.7/lib/python/site-packages/arlpy/plot.py in plot(x, y, fs, maxpts, pooling, color, style, thickness, marker, filled, size, mskip, title, xlabel, ylabel, xlim, ylim, xtype, ytype, width, height, legend, hold, interactive)
    394         _figure.add_layout(_bmodels.Label(x=5, y=5, x_units='screen', y_units='screen', text=desc, text_font_size="8pt", text_alpha=0.5))
    395     if style is not None:
--> 396         _figure.line(x, y, line_color=color, line_dash=style, line_width=thickness, legend=legend)
    397     if marker is not None:
    398         scatter(x[::(mskip+1)], y[::(mskip+1)], marker=marker, filled=filled, size=size, color=color, legend=legend, hold=True)

fakesource in line(self, x, y, **kwargs)

~/Library/Python/3.7/lib/python/site-packages/bokeh/plotting/helpers.py in func(self, **kwargs)
    930 
    931         if legend_kwarg:
--> 932             _update_legend(self, legend_kwarg, glyph_renderer)
    933 
    934         self.renderers.append(glyph_renderer)

~/Library/Python/3.7/lib/python/site-packages/bokeh/plotting/helpers.py in _update_legend(plot, legend_kwarg, glyph_renderer)
    487     kwarg, value = list(legend_kwarg.items())[0]
    488 
--> 489     _LEGEND_KWARG_HANDLERS[kwarg](value, legend, glyph_renderer)
    490 
    491 

~/Library/Python/3.7/lib/python/site-packages/bokeh/plotting/helpers.py in _handle_legend_deprecated(label, legend, glyph_renderer)
    414 
    415     if not isinstance(label, (string_types, dict)):
--> 416         raise ValueError("Bad 'legend' parameter value: %s" % label)
    417 
    418     if isinstance(label, dict):

ValueError: Bad 'legend' parameter value: None
patel999jay commented 4 years ago

You can solve this error with degrade the version of Bokeh 1.3, Please install manually Bokeh 1.3 by following command :

python -m pip install bokeh==1.3.0

if you don't know your current version of bokeh then please check with following command :

python -m pip freeze

I think this issue is already taken care of , Please look at the same issue .