holoviews: cellmagic output and options parsing problem

#%%output backend='matplotlib'
def rectangle(x=0, y=0, width=.05, height=.05):
    return np.array([(x,y), (x+width, y), (x+width, y+height), (x, y+height)])

hv.Polygons(rectangle()).opts([ hv.opts.Polygons(color='indianred',line_alpha=.5, padding=2, backend='bokeh'),
                                hv.opts.Polygons(color='lightblue', padding=2, backend='matplotlib')])

works as expected. Uncommenting the output backend cell magic results in WARNING:root:main: Option 'line_alpha' for Polygons type not valid for selected backend ('matplotlib'). Option only applies to following backends: ['bokeh'] in hv 1.11.2.post3+ged1cc85a3

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 23 (23 by maintainers)

Most upvoted comments

Even if you just build a hv.Options object and supply that?

Sure, but that’s another thing to document and introduce to users, if we can avoid making exceptions here that’d be preferable.

This could be possible if hv.Options gets a _backend attribute that the opts method checks for and uses. I don’t really see much of an issue with this, it just hasn’t been implemented yet.

If you’re on board with this then I think we all agree that’s the best solution.

@ea42gh To make sure, I can confirm your original example above now works as expected.