Holoviews Bars xlim

Hi

I am using Bars plot from holoviews, but it seem the xlim not working here.

And i find a solution by using param.range. (Unable to set xlim for image using apply.opts)
But it seem but supporting Period type of data. Any suggestion about how to make a xlim on period type of data.
here is a minimized example:

data = [(pd._libs.tslibs.period.Period(f'2019-0{x+1}', 'M'),x) for x in range(5)]

bars = hv.Bars(data).opts(xlim = (data[0][0],data[3][0]))

bars

Kind regards
Victor

I don’t think it is related to period as this does not work either:

import holoviews as hv
import pandas as pd

hv.extension("bokeh")

data = [(x, x) for x in range(5)]
hv.Bars(data).opts(xlim=(data[0][0], data[3][0]))

image

This will do what you want: bars.iloc[0:3]
image

References: Indexing and Selecting Data β€” HoloViews v1.15.4 and Barh Ignoring xlim - #3 by maximlt

1 Like