☰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

Custom Texture ---> hatch_scale?

Community Support
gmerritt123
gmerritt123

Hi,

Wondering if there’s a way to control the hatch_scale of a custom texture (instantiated using ImageURLTexture as suggested in the docs). Super powerful possibilities with this feature btw :slight_smile:

Minimized example:

from bokeh.models import Rect, ImageURLTexture, ColumnDataSource
from bokeh.plotting import figure,show

f = figure()

src = ColumnDataSource(data={‘x’:[1],‘y’:[1],‘w’:[1],‘h’:[1],‘texture’:[‘sand’]})
glyph = Rect(x=‘x’,y=‘y’,width=‘w’,height=‘h’,hatch_extra= {‘sand’:ImageURLTexture(url=‘https://www.myfreetextures.com/wp-content/uploads/2011/08/2011-06-11-09495.jpg’,repetition='repeat’)}
,hatch_pattern=‘texture’
,hatch_scale=0.1 #THIS DOESN’T SEEM DO ANYTHING
)
rend = f.add_glyph(src,glyph)
show(f)

Thank you!

Gaelen

⌁   Link to post
Bryan
Bryan

Most of the hatch options are ignored for image textures because they just don’t really apply (e.g. what would hatch_color do? The image specifies its own colors) and this includes hatch_scale

Since almost all the canvas rendering in Bokeh synchronous except image-based things, it seems like it might add a fair amount of complication to try and have hatch_scale do anything for images. If someone wants to work on this and has a coherent user story/set of requirements, I would be willing to try to offer any relevant guidance.

⌁   Link to post
gmerritt123
gmerritt123

I essentially hoped that given the texture is “repeating”, I could use the hatch_scale to scale down the size of each pixel in the image (with no added “cost” because it’d simply repeat itself more)… so this grate/mesh in my example would appear much finer (in the case of a hatch_scale<1) or coarser (>1).

⌁   Link to post
Bryan
Bryan

Right I do think hatch_scale could be interpreted as a plain pixel scaling. But I also think the “differentness” inherent to image handling will make it not quite as trivial to implement as it would be otherwise. Certainly a reasonable GitHub Issue to submit, I just can’t speculate when it might actually get worked on.

⌁   Link to post
Material-Scientist
Material-Scientist

I would also like this - my workaround is to just change the padding around the actual image.

But that’s in pixels and when the chart adjusts the size to i.e. fullscreen, the hatch pattern will just be all over the chart again.

⌁   Link to post

End of archived discussion · Replies are disabled