Possibly found 3 bugs ? Plotting interface colors setup for scatter

Hi everyone !

I would like to scatter points with different colors and alphas. I read

http://bokeh.pydata.org/en/latest/docs/user_guide/styling.html

And it says:

  • Colors
    properties are used in many places in Bokeh, to specify the colors to use for lines, fills or text. Color values can be provided in any of the
    following ways:*
  • any of the 147 named CSS colors, e.g 'green', 'indigo'
  • an RGB(A) hex value, e.g., '#FF0000', '#44444444'
  • a 3-tuple of integers (r,g,b) between 0 and 255
  • a 4-tuple of (r,g,b,a) where r, g, b are integers between 0 and 255 and a is a floating point value between 0 and 1
    and
    I am not sure if I found some bugs or whether I just don’t get the documentation above or I am confusing something …Having some initial code :

TOOLS=“resize,crosshair,pan,wheel_zoom,box_zoom,reset,tap,previewsave,box_select,poly_select,lasso_select”

output_file(“color_scatter.html”, title=“color_scatter.py example”)

p = figure(tools=TOOLS)

Now some experiments :

----- ----- ----- ----- 1st problem ----- ----- ----- ----- ----- ----- ----- Can’t specify alpha in hexadecimal format

p.scatter([1,2,3], [1,2,3], radius=[0.05,0.1,0.2], fill_color=“red”, fill_alpha=0.6, line_color=“Black”)

show§ # all good, red points as expected with alpha 0.6

p.scatter([1,2,3], [1,2,3], radius=[0.05,0.1,0.2], fill_color=“FF00000077”, line_color=“Black”)

show # now I thought I would get transparent red points by specifiing alpha to bde 0x77 but all points are just white.

Therefore I am ble to do this :

p.scatter([1,2,3], [1,2,3], radius=[0.05,0.1,0.2], fill_color=["#44FF4455", “#FF0000”, “#00FF00”], line_color=“Black”)

but not this

p.scatter([1,2,3], [1,2,3], radius=[0.05,0.1,0.2], fill_color=["#44FF4455", “#FF000088”, “#00FF00AA”], line_color=“Black”)

----- ----- ----- ----- 2nd problem ----- ----- ----- ----- ----- ----- ----- Can’t specify alpha in hexadecimal format

p.scatter([1,2,3], [1,2,3], radius=[0.05,0.1,0.2], fill_color=(0,255,255), line_color=“Black”);

show( p ) # works ok, skyblue scatter points

p.scatter([1,2,3], [1,2,3], radius=[0.05,0.1,0.2], fill_color=(0,255,255,255), line_color=“Black”);

show( p ) # adding the additional alpha this way completely breaks everything and nothing gets displayed at all

** -----
----- ----- ----- 3rd problem ----- ----- ----- ----- ----- ----- -----
Can’t specify array of for colors in list/tupple format**

p.scatter([1,2,3], [1,2,3], radius=[0.05,0.1,0.2], fill_color=[‘blue’,‘green’,‘red’], line_color=“Black”);

show( p ) # everything as expected, 3 points, different colors

p.scatter([1,2,3], [1,2,3], radius=[0.05,0.1,0.2], fill_color=[(0,0,255),(0,255,0),(255,0,0)], line_color=“Black”)

show ( p ) # I get just 3 white points

p.scatter([1,2,3], [1,2,3], radius=[0.05,0.1,0.2], fill_color=[[0,0,255],[0,255,0],[255,0,0]], line_color=“Black”)

show ( p ) # I get just 3 white points

Thank you for insights and comments in forward !!

I just add detail that I am using bokeh v0.9.1

One thing to mention is that “Black” (capital B) is not recognized as a color, all color names are lower case. When you put “Black”, Bokeh will try to interpret that as a column name in a data source. This will produce a logger error in Bokeh 0.9.1 (but you may need to enable logging). For instance, I get:

In [1]: from bokeh.plotting import *
In [2]: p = figure()
In [3]: p.scatter([1,2,3], [1,2,3], radius=[0.05,0.1,0.2], fill_color=["#44FF4455", "#FF000088", "#00FF00AA"], line_color="Black")Out[3]: <bokeh.plotting.Figure at 0x10828d978>
In [4]: output_file("/tmp/foo.html")
In [5]: show(p)
E-1001 (BAD_COLUMN_NAME): Glyph refers to nonexistent column name: Black [renderer: GlyphRenderer, ViewModel:GlyphRenderer, ref _id: 76099ce4-36f0-4485-b8f8-1daf6c59d941]

That said, there appears to be a bug in recognizing hex color values. Can you file a GH bug issue for this?

The next thing to note is that RGBA tuples have the “A” specified as a float 0…1.0, not as an integer. So adjusting your second example:

p.scatter([1,2,3], [1,2,3], radius=[0.05,0.1,0.2], fill_color=(0,255,255,1.0), line_color="black");

yields the image attached below, as expected.

The third example does appear to be a bug. I can set a single value as a color tuple, but a sequence of color tuples is not interpreted correctly. Can you file a GH issue for this?

Thanks,

Bryan

···

On Jul 14, 2015, at 11:24 AM, Patrik Stas [email protected] wrote:

I just add detail that I am using bokeh v0.9.1


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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/0754ec87-a9b8-44b5-88dc-2b6dc84f2cea%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Thank you for fast reply Bryan.
1 — How to enable logging ?
Can you help me how to enable logging ? I found http://bokeh.pydata.org/en/latest/docs/dev_guide/notes.html however are those environment in system or some sort of python variables ? I am not sure how to change it so I get the logging…
2— Hexadecimal alpha possible ?
Ahh the “Black” thing, however, if I do
p.scatter([1,2,3], [1,2,3], radius=[0.05,0.1,0.2], fill_color=“FF00000077” )
This still doesn’t work - I am not sure whether this is supposed to work or not ( alpha 0x77 ? ) . Can you confirm this is bug ?
3-- Bug report on GH
Okay I will issue the bug aobut the tuples as sequence of colors.
4-- Color mapping
Is there a way in bokeh to do something like
Palette = [“red”, ‘green’, ‘blue’]
ColorValue = 0.25
ColorCode = MapValueOnPalette(ColorValue, Palette)
And in ColorCode I would then be saved hexadecimal value of color transition color between the Red and Green ? ( or whathever tha pallete would be, some sort of linear mapping from 0-1 into #xxyyzz code according to the palette ?

I noticed there is LinearColorMapper in documentation, which sounds like could be something like that, however I don't understand how to use it..

Ultimately what I need to achieve is to scatter each point in my dataset with different color, different size and ideally even different alpha. Is that possible to do in bokeh right now ? I’ve been stuck on this for a while.

Thank you very much,
Patrik

···

On Tuesday, July 14, 2015 at 6:45:23 PM UTC+2, Bryan Van de ven wrote:

One thing to mention is that “Black” (capital B) is not recognized as a color, all color names are lower case. When you put “Black”, Bokeh will try to interpret that as a column name in a data source. This will produce a logger error in Bokeh 0.9.1 (but you may need to enable logging). For instance, I get:

In [1]: from bokeh.plotting import *
In [2]: p = figure()
In [3]: p.scatter([1,2,3], [1,2,3], radius=[0.05,0.1,0.2], fill_color=["#44FF4455", “#FF000088”, “#00FF00AA”], line_color=“Black”)Out[3]: <bokeh.plotting.Figure at 0x10828d978>
In [4]: output_file("/tmp/foo.html")
In [5]: show§
E-1001 (BAD_COLUMN_NAME): Glyph refers to nonexistent column name: Black [renderer: GlyphRenderer, ViewModel:GlyphRenderer, ref _id: 76099ce4-36f0-4485-b8f8-1daf6c59d941]

That said, there appears to be a bug in recognizing hex color values. Can you file a GH bug issue for this?

The next thing to note is that RGBA tuples have the “A” specified as a float 0…1.0, not as an integer. So adjusting your second example:

p.scatter([1,2,3], [1,2,3], radius=[0.05,0.1,0.2], fill_color=(0,255,255,1.0), line_color=“black”);

yields the image attached below, as expected.

The third example does appear to be a bug. I can set a single value as a color tuple, but a sequence of color tuples is not interpreted correctly. Can you file a GH issue for this?

Thanks,

Bryan

On Jul 14, 2015, at 11:24 AM, Patrik Stas [email protected] wrote:

I just add detail that I am using bokeh v0.9.1


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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/0754ec87-a9b8-44b5-88dc-2b6dc84f2cea%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

I believe default logging may be a python 2/3 issue. I use python 3 all the time and I have not done anything special to see error output. In python 2 am pretty sure you might see "No handlers could be found for logger X.Y.Z" or similar. you can try executing:

  import logging; logging.basicConfig()

with your code to enable logging output in python 2.

Yes there is are two bugs I think:

* parsing hex colors with alpha
* parsing color tuples inside a larger sequence

For now, you will need to map the colors yourself (LinearColorMapper lets you define a color mapper to be used by BokehJS, but it does not do any mapping on the python side). You can see an example that varies the color and size of circles here:

  https://github.com/bokeh/bokeh/blob/master/examples/plotting/file/color_scatter.py

If you also want to modify the alpha values, I would suggest creating a sequence of alpha values separately, and passing that as the "alpha" or "fill_alpha" parameter to p.circle(...) as appropriate. That definitely works, the ability to specify alpha together with the color is a very new feature that still has some issues it seems.

Bryan

···

On Jul 14, 2015, at 1:27 PM, Patrik Stas <[email protected]> wrote:

Thank you for fast reply Bryan.

1 --- How to enable logging ?
Can you help me how to enable logging ? I found http://bokeh.pydata.org/en/latest/docs/dev_guide/notes.html however are those environment in system or some sort of python variables ? I am not sure how to change it so I get the logging...

2--- Hexadecimal alpha possible ?
Ahh the "Black" thing, however, if I do
p.scatter([1,2,3], [1,2,3], radius=[0.05,0.1,0.2], fill_color="FF00000077" )
This still doesn't work - I am not sure whether this is supposed to work or not ( alpha 0x77 ? ) . Can you confirm this is bug ?

3-- Bug report on GH
Okay I will issue the bug aobut the tuples as sequence of colors.

4-- Color mapping
Is there a way in bokeh to do something like
Palette = ["red", 'green', 'blue']
ColorValue = 0.25
ColorCode = MapValueOnPalette(ColorValue, Palette)
And in ColorCode I would then be saved hexadecimal value of color transition color between the Red and Green ? ( or whathever tha pallete would be, some sort of linear mapping from 0-1 into #xxyyzz code according to the palette ?

I noticed there is LinearColorMapper in documentation, which sounds like could be something like that, however I don't understand how to use it..

Ultimately what I need to achieve is to scatter each point in my dataset with different color, different size and ideally even different alpha. Is that possible to do in bokeh right now ? I've been stuck on this for a while.

Thank you very much,
Patrik

On Tuesday, July 14, 2015 at 6:45:23 PM UTC+2, Bryan Van de ven wrote:
One thing to mention is that "Black" (capital B) is not recognized as a color, all color names are lower case. When you put "Black", Bokeh will try to interpret that as a column name in a data source. This will produce a logger error in Bokeh 0.9.1 (but you may need to enable logging). For instance, I get:

  In [1]: from bokeh.plotting import *
  In [2]: p = figure()
  In [3]: p.scatter([1,2,3], [1,2,3], radius=[0.05,0.1,0.2], fill_color=["#44FF4455", "#FF000088", "#00FF00AA"], line_color="Black")Out[3]: <bokeh.plotting.Figure at 0x10828d978>
  In [4]: output_file("/tmp/foo.html")
  In [5]: show(p)
  E-1001 (BAD_COLUMN_NAME): Glyph refers to nonexistent column name: Black [renderer: GlyphRenderer, ViewModel:GlyphRenderer, ref _id: 76099ce4-36f0-4485-b8f8-1daf6c59d941]

That said, there appears to be a bug in recognizing hex color values. Can you file a GH bug issue for this?

The next thing to note is that RGBA tuples have the "A" specified as a float 0..1.0, not as an integer. So adjusting your second example:

  p.scatter([1,2,3], [1,2,3], radius=[0.05,0.1,0.2], fill_color=(0,255,255,1.0), line_color="black");

yields the image attached below, as expected.

The third example does appear to be a bug. I can set a single value as a color tuple, but a sequence of color tuples is not interpreted correctly. Can you file a GH issue for this?

Thanks,

Bryan

On Jul 14, 2015, at 11:24 AM, Patrik Stas <[email protected]> wrote:

I just add detail that I am using bokeh v0.9.1

--
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/0754ec87-a9b8-44b5-88dc-2b6dc84f2cea%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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/a4552537-4837-42e1-a5c8-5aff94ae06e1%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Hi, I’ve been sprinting at EuroPython2015 and also bumped into this. I’ve been advised to review this thread and to log an issue on githib.
Check it out here: https://github.com/bokeh/bokeh/issues/2615

Cheers,

···


Tiago

On Tuesday, July 14, 2015 at 6:22:20 PM UTC+2, Patrik Stas wrote:

Hi everyone !

I would like to scatter points with different colors and alphas. I read

http://bokeh.pydata.org/en/latest/docs/user_guide/styling.html

And it says:

  • Colors
    properties are used in many places in Bokeh, to specify the colors to use for lines, fills or text. Color values can be provided in any of the
    following ways:*
  • any of the 147 named CSS colors, e.g 'green', 'indigo'
  • an RGB(A) hex value, e.g., '#FF0000', '#44444444'
  • a 3-tuple of integers (r,g,b) between 0 and 255
  • a 4-tuple of (r,g,b,a) where r, g, b are integers between 0 and 255 and a is a floating point value between 0 and 1
    and
    I am not sure if I found some bugs or whether I just don’t get the documentation above or I am confusing something …Having some initial code :

TOOLS=“resize,crosshair,pan,wheel_zoom,box_zoom,reset,tap,previewsave,box_select,poly_select,lasso_select”

output_file(“color_scatter.html”, title=“color_scatter.py example”)

p = figure(tools=TOOLS)

Now some experiments :

----- ----- ----- ----- 1st problem ----- ----- ----- ----- ----- ----- ----- Can’t specify alpha in hexadecimal format

p.scatter([1,2,3], [1,2,3], radius=[0.05,0.1,0.2], fill_color=“red”, fill_alpha=0.6, line_color=“Black”)

show§ # all good, red points as expected with alpha 0.6

p.scatter([1,2,3], [1,2,3], radius=[0.05,0.1,0.2], fill_color=“FF00000077”, line_color=“Black”)

show # now I thought I would get transparent red points by specifiing alpha to bde 0x77 but all points are just white.

Therefore I am ble to do this :

p.scatter([1,2,3], [1,2,3], radius=[0.05,0.1,0.2], fill_color=["#44FF4455", “#FF0000”, “#00FF00”], line_color=“Black”)

but not this

p.scatter([1,2,3], [1,2,3], radius=[0.05,0.1,0.2], fill_color=["#44FF4455", “#FF000088”, “#00FF00AA”], line_color=“Black”)

----- ----- ----- ----- 2nd problem ----- ----- ----- ----- ----- ----- ----- Can’t specify alpha in hexadecimal format

p.scatter([1,2,3], [1,2,3], radius=[0.05,0.1,0.2], fill_color=(0,255,255), line_color=“Black”);

show( p ) # works ok, skyblue scatter points

p.scatter([1,2,3], [1,2,3], radius=[0.05,0.1,0.2], fill_color=(0,255,255,255), line_color=“Black”);

show( p ) # adding the additional alpha this way completely breaks everything and nothing gets displayed at all

** -----
----- ----- ----- 3rd problem ----- ----- ----- ----- ----- ----- -----
Can’t specify array of for colors in list/tupple format**

p.scatter([1,2,3], [1,2,3], radius=[0.05,0.1,0.2], fill_color=[‘blue’,‘green’,‘red’], line_color=“Black”);

show( p ) # everything as expected, 3 points, different colors

p.scatter([1,2,3], [1,2,3], radius=[0.05,0.1,0.2], fill_color=[(0,0,255),(0,255,0),(255,0,0)], line_color=“Black”)

show ( p ) # I get just 3 white points

p.scatter([1,2,3], [1,2,3], radius=[0.05,0.1,0.2], fill_color=[[0,0,255],[0,255,0],[255,0,0]], line_color=“Black”)

show ( p ) # I get just 3 white points

Thank you for insights and comments in forward !!

I think this is a duplicate post. I responded to this one a little more than a week ago:
https://groups.google.com/a/continuum.io/forum/?utm_medium=email&utm_source=footer#!msg/bokeh/x3PuNDUdRLA/XC2BsPEndoEJ

I just followed up on it in the new github issue:

···

On Saturday, July 25, 2015 at 1:28:50 PM UTC-5, [email protected] wrote:

Hi, I’ve been sprinting at EuroPython2015 and also bumped into this. I’ve been advised to review this thread and to log an issue on githib.
Check it out here: https://github.com/bokeh/bokeh/issues/2615

Cheers,

Tiago

On Tuesday, July 14, 2015 at 6:22:20 PM UTC+2, Patrik Stas wrote:

Hi everyone !

I would like to scatter points with different colors and alphas. I read

http://bokeh.pydata.org/en/latest/docs/user_guide/styling.html

And it says:

  • Colors
    properties are used in many places in Bokeh, to specify the colors to use for lines, fills or text. Color values can be provided in any of the
    following ways:*
  • any of the 147 named CSS colors, e.g 'green', 'indigo'
  • an RGB(A) hex value, e.g., '#FF0000', '#44444444'
  • a 3-tuple of integers (r,g,b) between 0 and 255
  • a 4-tuple of (r,g,b,a) where r, g, b are integers between 0 and 255 and a is a floating point value between 0 and 1
    and
    I am not sure if I found some bugs or whether I just don’t get the documentation above or I am confusing something …Having some initial code :

TOOLS=“resize,crosshair,pan,wheel_zoom,box_zoom,reset,tap,previewsave,box_select,poly_select,lasso_select”

output_file(“color_scatter.html”, title=“color_scatter.py example”)

p = figure(tools=TOOLS)

Now some experiments :

----- ----- ----- ----- 1st problem ----- ----- ----- ----- ----- ----- ----- Can’t specify alpha in hexadecimal format

p.scatter([1,2,3], [1,2,3], radius=[0.05,0.1,0.2], fill_color=“red”, fill_alpha=0.6, line_color=“Black”)

show§ # all good, red points as expected with alpha 0.6

p.scatter([1,2,3], [1,2,3], radius=[0.05,0.1,0.2], fill_color=“FF00000077”, line_color=“Black”)

show # now I thought I would get transparent red points by specifiing alpha to bde 0x77 but all points are just white.

Therefore I am ble to do this :

p.scatter([1,2,3], [1,2,3], radius=[0.05,0.1,0.2], fill_color=["#44FF4455", “#FF0000”, “#00FF00”], line_color=“Black”)

but not this

p.scatter([1,2,3], [1,2,3], radius=[0.05,0.1,0.2], fill_color=["#44FF4455", “#FF000088”, “#00FF00AA”], line_color=“Black”)

----- ----- ----- ----- 2nd problem ----- ----- ----- ----- ----- ----- ----- Can’t specify alpha in hexadecimal format

p.scatter([1,2,3], [1,2,3], radius=[0.05,0.1,0.2], fill_color=(0,255,255), line_color=“Black”);

show( p ) # works ok, skyblue scatter points

p.scatter([1,2,3], [1,2,3], radius=[0.05,0.1,0.2], fill_color=(0,255,255,255), line_color=“Black”);

show( p ) # adding the additional alpha this way completely breaks everything and nothing gets displayed at all

** -----
----- ----- ----- 3rd problem ----- ----- ----- ----- ----- ----- -----
Can’t specify array of for colors in list/tupple format**

p.scatter([1,2,3], [1,2,3], radius=[0.05,0.1,0.2], fill_color=[‘blue’,‘green’,‘red’], line_color=“Black”);

show( p ) # everything as expected, 3 points, different colors

p.scatter([1,2,3], [1,2,3], radius=[0.05,0.1,0.2], fill_color=[(0,0,255),(0,255,0),(255,0,0)], line_color=“Black”)

show ( p ) # I get just 3 white points

p.scatter([1,2,3], [1,2,3], radius=[0.05,0.1,0.2], fill_color=[[0,0,255],[0,255,0],[255,0,0]], line_color=“Black”)

show ( p ) # I get just 3 white points

Thank you for insights and comments in forward !!