Hi,
I’m trying to use hatch_patterns as watermarks. It works for i.e. vbars, but it might be better if it were used in a band_hatch.
So, this works:
from bokeh.io import output_file, show
from bokeh.plotting import figure
from bokeh.models import ImageURLTexture
import panel as pn
import holoviews as hv
import numpy as np
hv.extension('bokeh')
pn.extension()
p = figure(height=250, width=600)
p.vbar(x=[0],
top=[1],
alpha=0.2,
hatch_extra={ 'mycustom': ImageURLTexture(url='https://miro.medium.com/fit/c/262/262/2*hYgXkcU-IzRzAGrw4kN5lQ.png') },
hatch_pattern = dict(value="mycustom"),hatch_scale=12
)
pn.Column(p)
But this does not:
from bokeh.io import output_file, show
from bokeh.plotting import figure
from bokeh.models import ImageURLTexture
import panel as pn
import holoviews as hv
import numpy as np
hv.extension('bokeh')
pn.extension()
p = figure(height=250, width=600)
p.vbar(x=[0],
top=[1],
alpha=0.2,
# hatch_extra={ 'mycustom': ImageURLTexture(url='https://miro.medium.com/fit/c/262/262/2*hYgXkcU-IzRzAGrw4kN5lQ.png') },
# hatch_pattern = dict(value="mycustom"),hatch_scale=12
)
p.xgrid.band_hatch_extra={ 'mycustom': ImageURLTexture(url='https://miro.medium.com/fit/c/262/262/2*hYgXkcU-IzRzAGrw4kN5lQ.png') }
p.xgrid.band_hatch_pattern = 'mycustom'
pn.Column(p)
Using '/'
as hatch_pattern, you get this:
Am I doing it wrong or do band_hatch_patterns just not support images?
Bryan
September 19, 2021, 5:55pm
2
I don’t know that this specific combination of usage has ever been explicitly considered. Are there any errors reported in the browser’s JavaScript console?
Edit: also please always include version information in all support questions, so that others can actually try your code in the same context.
No errors in the console apart from the missing favicon if I serve it as an app.
Package info:
bokeh: 2.3.3
panel: 0.12.0
*but it also doesn’t work with 2.4.0 & 0.12.2
Bryan
September 20, 2021, 2:58pm
4
All I can suggest at this point is to file a bug report GitHub Issue with these details.
1 Like
OK - I was just unsure if this was really a bug or if I didn’t use it properly.
Bug report:
opened 03:49PM - 20 Sep 21 UTC
closed 11:05PM - 20 Sep 21 UTC
type: bug
tag: regression
reso: completed
tag: component: bokehjs
Hi,
I’m trying to use hatch_patterns as watermarks. It works for i.e. vbars, bu… t it might be better if it were used in a band_hatch.
#### ALL software version info
bokeh: 2.3.3
panel: 0.12.0
python: 3.8.11
jupyterlab: 3.1.7
OS: Windows 10, version 20H2
#### Description of expected behavior and the observed behavior & minimal reproducible example
So, this works:
```
from bokeh.plotting import figure
from bokeh.models import ImageURLTexture
import panel as pn
pn.extension()
p = figure(height=250, width=600)
p.vbar(x=[0],
top=[1],
alpha=0.2,
hatch_extra={ 'mycustom': ImageURLTexture(url='https://miro.medium.com/fit/c/262/262/2*hYgXkcU-IzRzAGrw4kN5lQ.png') },
hatch_pattern = dict(value="mycustom"),hatch_scale=12
)
pn.Column(p)
```
Output:
![image](https://user-images.githubusercontent.com/40465719/134031505-5020769c-3380-4d89-9df0-71e16b22473b.png)
But this does not:
```
from bokeh.plotting import figure
from bokeh.models import ImageURLTexture
import panel as pn
pn.extension()
p = figure(height=250, width=600)
p.vbar(x=[0],
top=[1],
alpha=0.2,
# hatch_extra={ 'mycustom': ImageURLTexture(url='https://miro.medium.com/fit/c/262/262/2*hYgXkcU-IzRzAGrw4kN5lQ.png') },
# hatch_pattern = dict(value="mycustom"),hatch_scale=12
)
p.xgrid.band_hatch_extra={ 'mycustom': ImageURLTexture(url='https://miro.medium.com/fit/c/262/262/2*hYgXkcU-IzRzAGrw4kN5lQ.png') }
p.xgrid.band_hatch_pattern = 'mycustom'
pn.Column(p)
```
Output:
![image](https://user-images.githubusercontent.com/40465719/134031944-ffa987ff-ddfa-4ee8-8585-92e2a63d073a.png)
Using `'/'` as hatch_pattern, you get this:
![image](https://user-images.githubusercontent.com/40465719/134032135-dc8c1883-f5f9-4ec2-9f87-9fa90bc0bf5e.png)
I'm not sure if I'm using it incorrectly, if band_hatch_patterns just don't support images, or if they're bugged.
#### Stack traceback and/or browser JavaScript console output
If I serve it as an app, I get no error in the console apart from the missing favicon.
1 Like
Bryan
September 20, 2021, 10:15pm
6
PR to fix:
bokeh:branch-3.0
← bokeh:mattpap/11646_hatch_image
opened 10:03PM - 20 Sep 21 UTC
Note this bug only affects grid bands, etc., i.e. visual properties, but not sca… lar or vector visuals.
fixes #11646
Lands on branch-3.0
but we will back port it to a 2.4.1 to be released much sooner than that.
1 Like
system
Closed
December 19, 2021, 11:59pm
8
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.