☰Read-only archive⌕
Looking for help with Bokeh?

This is a read-only archive. Ask questions and join the conversation on GitHub.

Visit Community Support on GitHub →
Archived discussions · Captured October 28, 2026

I need the same 12 colors for each bar chart

Community Support
scheine
scheine

The below will give random 12 colors to each bar chart. How should I modify it to make the colors consistent across each of the three bar charts?

p1.vbar(x=Segment, top=df['Population'], width=0.9,
      color = random.sample(Viridis256,12), fill_alpha=.75)

p2.vbar(x=Segment, top=df['Size'], width=0.9,
      color = random.sample(Viridis256,12), fill_alpha=.75)

p3.vbar(x=Segment, top=df['MPG'], width=0.9,
      color = random.sample(Viridis256,12), fill_alpha=.75)
⌁   Link to post
Bryan
Bryan

Create one list of random colors up front, and pass that same list of colors to each call to vbar, instead of creating a new list of random colors for each call as you are doing now.

⌁   Link to post

End of archived discussion · Replies are disabled