Changing extents or axial constraints on complex Golovyev shapes

I see examples of how to edit extents (like axis constraints) for individual objects like images or histograms in heads for example this answer on swapping stacks for histogram extents.How about if you want to apply this to something more complex such as an NdOverlay or HoloMap object? Basically, I want to apply constraints to an entire axis or shape without worrying about every element I might have in the specified axis or shape.

For example, suppose I have the following and want to remove the suppressed zero on the axis:

df = pd.DataFrame({'A':[1,2,3,1,2,3],'B':[4,5,6,1,4,9],'C':['a','a','a','b','b','b']})
tbl = hv.Table(df)
fig = tbl.to.curve(kdims=['A'],vdims=['B'],mdims=['C']).overlay()
fig *= hv.Points([(3,4),(5,6),(1,3)])
fig

      

Complex figure

What is the best way to apply custom graphics constraints for multi-item objects like this overlay or HoloMap? I would prefer not to filter the data as this can be cumbersome if you are doing research work that combines multiple data sources. Do I need to apply the extent keyword to each component, or is there an easy way to pass it across the entire drawing?

Thanks for any help.

+3


source to share


1 answer


The easiest way to specify explicit axis constraints is to use the method redim

(assuming you are using a recent version of Devo for HoloViews). In your case, it will look something like this:

df = pd.DataFrame({'A':[1,2,3,1,2,3],'B':[4,5,6,1,4,9],'C':
['a','a','a','b','b','b']})
tbl = hv.Table(df)
fig = tbl.to.curve(kdims=['A'],vdims=['B'],mdims=['C']).overlay()
fig *= hv.Points([(3,4),(5,6),(1,3)])
fig.redim(A=dict(range=(0, 6)), B=dict(range=(0, 10)))

      



The method redim

recursively iterates over your object and allows you to override any Dimension parameters, including ranges, in this way.

+4


source







All Articles