☰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

Color filter in a chart

Community Support
Mudit_Uppal
Mudit_Uppal

Hi I have a rather basic question regarding color. Is there a way to specify a different color for a bar chart or any type of chart where value is greater than some value?

Right now, its simply:

q1 = Bar(topics, label=‘Topic’, values=‘Number of Posts’, title=“Total posts”)

show(q1)

Like I want maybe a green color if ‘Number of Posts’ > 300

Thanks :slight_smile:

⌁   Link to post
Bryan
Bryan

Hi Mudit,

The high level charts interface is intended to to make the commonest cases completely trivial. To exert more control, you'll probably want to look at the mid-level bokeh.plotting interface. You can see an example of bar-like plots using the "quad" glyph function here:

  http://bokeh.pydata.org/en/latest/docs/gallery/histogram.html

With bokeh.plotting you can easily set the individual colors for bars (or whatever glyphs you are display) by setting the "fill_color" property to list of colors. For example, this example shows individually coloring individual circles:

  http://bokeh.pydata.org/en/latest/docs/gallery/color_scatter.html

Bryan

···

On Feb 27, 2016, at 6:59 PM, Mudit Uppal <mudit.bodom@gmail.com> wrote:

Hi I have a rather basic question regarding color. Is there a way to specify a different color for a bar chart or any type of chart where value is greater than some value?

Right now, its simply:

q1 = Bar(topics, label='Topic', values='Number of Posts', title="Total posts")
show(q1)

Like I want maybe a green color if 'Number of Posts' > 300

Thanks :slight_smile:

--
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/9bcf9cdb-77a9-4be6-a9bb-ea96f03a9c4d%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

⌁   Link to post
birdsarah_continuum
birdsarah_continuum
more_drops = tf.interpolate(drops.where(drops > picks), "lightblue", 'blue', how=how)
    more_picks = tf.interpolate(picks.where(picks > drops), "lightpink", 'red',  how=how)

Hi Mudit,

                That's a

really interesting i dea, it reminds me of the ideas in
DataShader where you can apply “visual transforms”

Best,

Bird
···

https://github.com/bokeh/datashader/blob/master/examples/nyc_taxi.ipynb

Bryan’s already answered how you could do this for now, but if you could
open a github issue
for this feature idea, that would be great.
On 2/27/16 4:59 PM, Mudit Uppal wrote:

    Hi I have a rather basic question regarding color.

Is there a way to specify a different color for a bar chart or
any type of chart where value is greater than some value?

Right now, its simply:

        q1 = Bar(topics, label='Topic', values='Number of Posts',

title=“Total posts”)

show(q1)

      Like I want maybe a green color if 'Number of Posts' >

300

Thanks :slight_smile:

–

  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/9bcf9cdb-77a9-4be6-a9bb-ea96f03a9c4d%40continuum.io?utm_medium=email&utm_source=footer)      .

For more options, visit .

–
Sarah Bird
Developer, Bokeh

    [
      ![Continuum Analytics](http://docs.continuum.io/_static/img/ContinuumWordmark.png)
    ](http://continuum.io)

https://groups.google.com/a/continuum.io/d/msgid/bokeh/9bcf9cdb-77a9-4be6-a9bb-ea96f03a9c4d%40continuum.io
https://groups.google.com/a/continuum.io/d/optout

⌁   Link to post

End of archived discussion · Replies are disabled