Timeseries Data#

Almost all the other sections in the user guide mention timeseries. This section demonstrates the special functionality that hvPlot provides specifically for dealing with time.

import hvplot.pandas  # noqa
from bokeh.sampledata.sea_surface_temperature import sea_surface_temperature as sst

sst.hvplot()

By default, the index will be used as the x-axis when plotting tabular data. If the index is composed of datetimes, and they are not in chronological order, hvPlot will try to sort them before plotting (unless you set sort_date=False).

scrampled = sst.sample(frac=1)
scrampled.hvplot()

Tickers#

The datetime tickers will be set to a default that is meant to fit in the allotted space. If you’d rather use a different format, then you can declare an explicit date ticker according to the rules on Bokeh DatetimeTickFormatter.

from bokeh.models.formatters import DatetimeTickFormatter

formatter = DatetimeTickFormatter(months='%b %Y')
sst.hvplot(xformatter=formatter)