Skip to content

Colors break things when passed to Bokeh #158

@sapols

Description

@sapols

I'm confused about the source of this error, but not all color values passed to Bokeh end up being converted to something Bokeh considers valid.

E.g. if I run the following:

mms_fgm = pyspedas.mms.fgm(trange=['2015-10-16/13:05:30', '2015-10-16/13:07:30'], data_rate='brst')
pytplot.options('mms1_fgm_b_gse_brst_l2-despike', 'color', ['red, blue, green, orange'])
pytplot.options('mms1_fgm_b_gsm_brst_l2-despike', 'color', ['cyan', 'magenta', 'yellow', 'black'])
tplot(['mms1_fgm_b_gse_brst_l2-despike', 'mms1_fgm_b_gsm_brst_l2-despike'], bokeh=True)

I get the error from Bokeh:
ValueError: failed to validate Line(id='1038', ...).line_color: expected either None or a value of type Color, got 'red, blue, green, orange'

That error ends with got 'b' when I don't manually set the colors, although I have no idea where 'b' is coming from.

Bokeh is happy if I pass a single color to the options instead of a list. E.g.,

pytplot.options('mms1_fgm_b_gse_brst_l2-despike', 'color', 'red')
pytplot.options('mms1_fgm_b_gsm_brst_l2-despike', 'color', 'blue')
tplot(['mms1_fgm_b_gse_brst_l2-despike', 'mms1_fgm_b_gsm_brst_l2-despike'], bokeh=True)

works fine.

Only other info I can provide:

  • The stack trace originates from line 98 of TVarFigure1D.py
  • The Bokeh error comes from line 365 of bokeh/core/property/bases.py
  • Using the latest versions of both pytplot and bokeh

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions