Is it possible to add a hatch to a rectangle?

Does anyone know how to add a hatch pattern to a bokeh plot rectangle?

from bokeh.plotting import figure, show

p = figure(width=400, height=400)
p.quad(top=[2, 3, 4], bottom=[1, 2, 3], left=[1, 2, 3],
       right=[1.2, 2.5, 3.7], color="#B3DE69",
       HATCH=?????
)

show(p)

I am looking for something like http://matplotlib.org/examples/pylab_examples/hatch_demo.html

Thanks,
Jeremy

Jeremy,

There is currently no support for hatching in Bokeh. There is a low-level HTML canvas for defining fill patterns, but it is not exposed. Perhaps it could be added some day, so I'd encourage you to file a GH issue for this feature request.

In the mean time, the only immediate avenue I can suggest is a custom extension that subclasses the Rect renderer and adds in a fixed pattern manually.

I won't say it is a trivial task, but if you have some familiarity with javascript/coffeescript it could bd doable. Here is the users guide section on extending bokeh:

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

And here is a Stack Overflow question with information about drawing fill patterns on HTML canvas:

  http://stackoverflow.com/questions/17518107/creating-html5-canvas-patterns-and-filling-stuff-with-them

Of course, I would try to answer any specific questions as best I could if you do try this route.

Thanks,

Bryan

···

On Sep 24, 2016, at 8:29 PM, jeremy freeman <[email protected]> wrote:

Does anyone know how to add a hatch pattern to a bokeh plot rectangle?

from bokeh.plotting import figure, show

p = figure(width=400, height=400)
p.quad(top=[2, 3, 4], bottom=[1, 2, 3], left=[1, 2, 3],

right=[1.2, 2.5, 3.7], color="#B3DE69",
       HATCH=???
)

show(p)

I am looking for something like http://matplotlib.org/examples/pylab_examples/hatch_demo.html

Thanks,
Jeremy

--
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/74d7bf13-2dfa-4eb5-bcb9-d36e51ef9cdc%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Bryan,

Thanks for the direction to go.

I am looking at a workaround now and if that does not work, I will com back to the list with specific questions on subclassing the Rect renderer.

I find that the calling link between the python code and and javascript code was not readily understood by me, someone new to the package.

Thanks,
Jeremy

···

On Oct 1, 2016, at 10:31 PM, Bryan Van de Ven <[email protected]> wrote:

Jeremy,

There is currently no support for hatching in Bokeh. There is a low-level HTML canvas for defining fill patterns, but it is not exposed. Perhaps it could be added some day, so I'd encourage you to file a GH issue for this feature request.

In the mean time, the only immediate avenue I can suggest is a custom extension that subclasses the Rect renderer and adds in a fixed pattern manually.

I won't say it is a trivial task, but if you have some familiarity with javascript/coffeescript it could bd doable. Here is the users guide section on extending bokeh:

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

And here is a Stack Overflow question with information about drawing fill patterns on HTML canvas:

  http://stackoverflow.com/questions/17518107/creating-html5-canvas-patterns-and-filling-stuff-with-them

Of course, I would try to answer any specific questions as best I could if you do try this route.

Thanks,

Bryan

On Sep 24, 2016, at 8:29 PM, jeremy freeman <[email protected]> wrote:

Does anyone know how to add a hatch pattern to a bokeh plot rectangle?

from bokeh.plotting import figure, show

p = figure(width=400, height=400)
p.quad(top=[2, 3, 4], bottom=[1, 2, 3], left=[1, 2, 3],

right=[1.2, 2.5, 3.7], color="#B3DE69",
      HATCH=???
)

show(p)

I am looking for something like http://matplotlib.org/examples/pylab_examples/hatch_demo.html

Thanks,
Jeremy

--
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/74d7bf13-2dfa-4eb5-bcb9-d36e51ef9cdc%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/C9C4D620-B2AB-4FA6-B800-C8310AD558CD%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.