☰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

Specify own colors on each bars respectively in Bokeh

Community Support
Nitin_Solanki
Nitin_Solanki

I’ve a data frame in pandas having x, count and colors columns.

x count colors
1   4      #99d594
1   4      #99d594
2   3      #ffffbf

I want to plot a bar chart having x on x-axis and count on y-axis and colors column define color for x column respectively.

plt = Bar(df, label='count', title="Bar chart", legend='top_left', color="colors")

But Bokeh doesn’t uses the given color codes in colors column. It uses their own itself but #99d594 and #ffffbf are different in colors. .

Please check Stackoverflow link - http://stackoverflow.com/q/44016554/1749606 for more explanation.

Nitin

⌁   Link to post
Alex_Schmitt
Alex_Schmitt

Change for:

palette=[“#99d594”, “#99d594”, “#ffffbf”]

plt = Bar(df, label=‘count’, title=“Bar chart”,

plot_width=700, plot_height=300, legend=‘top_left’,

color=color( columns=‘colors’, palette=palette, sort=False))

output_file(“test.html”)

Should do what you expect :slight_smile:

Best,

alEx

···

On Wed, May 17, 2017 at 7:51 AM Nitin Solanki nitin.solanki@synerzip.com wrote:

I’ve a data frame in pandas having x, count and colors columns.

x count colors
1   4      #99d594
1   4      #99d594
2   3      #ffffbf

I want to plot a bar chart having x on x-axis and count on y-axis and colors column define color for x column respectively.

plt = Bar(df, label='count', title="Bar chart", legend='top_left', color="colors")

But Bokeh doesn’t uses the given color codes in colors column. It uses their own itself but #99d594 and #ffffbf are different in colors. .

Please check Stackoverflow link - http://stackoverflow.com/q/44016554/1749606 for more explanation.

Nitin

This e-mail, including any attached files, may contain confidential and privileged information for the sole use of the intended recipient. Any review, use, distribution, or disclosure by others is strictly prohibited. If you are not the intended recipient (or authorized to receive information for the intended recipient), please contact the sender by reply e-mail and delete all copies of this message.

–

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/84f21c83-7fea-43a5-99c5-59ed81e71c30%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

⌁   Link to post
Nitin_Solanki
Nitin_Solanki

Thanks. It worked.

Nitin

This e-mail, including any attached files, may contain confidential and privileged information for the sole use of the intended recipient. Any review, use, distribution, or disclosure by others is strictly prohibited. If you are not the intended recipient (or authorized to receive information for the intended recipient), please contact the sender by reply e-mail and delete all copies of this message.

···

On Wed, May 17, 2017 at 12:31 PM, Alex Schmitt iscandarster@gmail.com wrote:

Change for:

palette=[“#99d594”, “#99d594”, “#ffffbf”]

plt = Bar(df, label=‘count’, title=“Bar chart”,

plot_width=700, plot_height=300, legend=‘top_left’,

color=color( columns=‘colors’, palette=palette, sort=False))

output_file(“test.html”)

Should do what you expect :slight_smile:

Best,

alEx

On Wed, May 17, 2017 at 7:51 AM Nitin Solanki nitin.solanki@synerzip.com wrote:

I’ve a data frame in pandas having x, count and colors columns.

x count colors
1   4      #99d594
1   4      #99d594
2   3      #ffffbf

I want to plot a bar chart having x on x-axis and count on y-axis and colors column define color for x column respectively.

plt = Bar(df, label='count', title="Bar chart", legend='top_left', color="colors")

But Bokeh doesn’t uses the given color codes in colors column. It uses their own itself but #99d594 and #ffffbf are different in colors. .

Please check Stackoverflow link - http://stackoverflow.com/q/44016554/1749606 for more explanation.

Nitin

This e-mail, including any attached files, may contain confidential and privileged information for the sole use of the intended recipient. Any review, use, distribution, or disclosure by others is strictly prohibited. If you are not the intended recipient (or authorized to receive information for the intended recipient), please contact the sender by reply e-mail and delete all copies of this message.

–

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/84f21c83-7fea-43a5-99c5-59ed81e71c30%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

–

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/CAJjPzf8-ZghRO73kkLMEtNiH-yQy%2BRgjgHNBy7KAumGs1YJi%3Dg%40mail.gmail.com.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

⌁   Link to post

End of archived discussion · Replies are disabled