Skip to content

bokeh server: color palette rgb is not recognized #4096

Closed
@mdk73

Description

@mdk73

The following code plots a few lines with changing color (rgb):

from pandas import DataFrame
from bokeh.io import show, output_file, output_server
from bokeh.charts import Line, color
import subprocess
import time

if __name__ == '__main__':   
    output_file('rgb-platte.html')

    df = DataFrame({'1': [0,1],
                    '2': [1,2],
                    '3': [2,3],
                    '4': [3,4],
                    '5': [4,5]})

    # set color palette rgb
    palette_r = [50, 100, 150, 200, 250]     # changing the values for 'red'.
    palette_g = 5 * [0]    # keeping values for 'green' constant. 
    palette_b = 5 * [0]    # keeping values for 'blue' constant. 
    palette = list(zip(palette_r, palette_g, palette_b))

    # define the plot
    p = Line(df, title="palette rgb", plot_width = 300, plot_height = 200, color=palette)

    show(p)

Result:
image

Now I replace output_file('rgb-platte.html') with:

    # start a bokeh server
    args = ['python', '-m', 'bokeh', 'serve']
    server = subprocess.Popen(args) 
    time.sleep(1) # wait for the server to initialize
    output_server('test')

to use the bokeh server.

The resulting image has no colors:
image

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions