hvPlot.step#

hvPlot.step(x=None, y=None, where='mid', **kwds)[source]#

The step plot connects the points with piece-wise constant curves.

The step plot can be used pretty much anytime the line plot might be used, and has many of the same options available.

Reference: https://hvplot.holoviz.org/ref/api/manual/hvplot.hvPlot.step.html

Plotting options: https://hvplot.holoviz.org/ref/plotting_options/index.html

Parameters:
xstring, optional

Field name(s) to draw x-positions from. If not specified, the index is used. Must refer to continuous data. Not categorical data.

ystring or list, optional

Field name(s) to draw y-positions from. If not specified, all numerical fields are used.

bystring, optional

A single field or list of fields to group by. All the subgroups are visualized.

groupby: string, list, optional

A single field or list of fields to group and filter by. Adds one or more widgets to select the subgroup(s) to visualize.

where: string, optional

Controls the transition point of the step along the x-axis. One of 'mid', 'pre', 'post'. Default is 'mid'.

colorstr or array-like, optional.

The color for each of the series. Possible values are:

A single color string referred to by name, RGB or RGBA code, for instance ‘red’ or ‘#a98d19.

A sequence of color strings referred to by name, RGB or RGBA code, which will be used for each series recursively. For instance [‘green’,’yellow’] each field’s line will be filled in green or yellow, alternatively. If there is only a single series to be plotted, then only the first color from the color list will be used.

**kwdsoptional

Additional keywords arguments are documented in Plotting Options. Run hvplot.help('step') for the full method documentation.

Returns:
holoviews.element.Curve / Panel object

You can print the object to study its composition and run:

import holoviews as hv
hv.help(the_holoviews_object)

to learn more about its parameters and options.

References

Backend-specific styling options#

alpha, color, hover_alpha, hover_color, hover_line_alpha, hover_line_cap, hover_line_color, hover_line_dash, hover_line_dash_offset, hover_line_join, hover_line_width, line_alpha, line_cap, line_color, line_dash, line_dash_offset, line_join, line_width, muted, muted_alpha, muted_color, muted_line_alpha, muted_line_cap, muted_line_color, muted_line_dash, muted_line_dash_offset, muted_line_join, muted_line_width, nonselection_alpha, nonselection_color, nonselection_line_alpha, nonselection_line_cap, nonselection_line_color, nonselection_line_dash, nonselection_line_dash_offset, nonselection_line_join, nonselection_line_width, selection_alpha, selection_color, selection_line_alpha, selection_line_cap, selection_line_color, selection_line_dash, selection_line_dash_offset, selection_line_join, selection_line_width, visible

alpha, c, color, linestyle, linewidth, lw, marker, ms, visible

Examples#

Basic step plot#

import hvplot.pandas  # noqa
import pandas as pd

df = pd.DataFrame({"y": [0, 1, 4, 2]})

df.hvplot.step()

Basic step plot for stock prices#

This example shows Apple’s adjusted closing prices using a step plot to visualize discrete daily changes.

import hvplot.pandas # noqa

df = hvplot.sampledata.apple_stocks("pandas")

df[:50].hvplot.step(x='date', y='adj_close')

Customize the interpolation method with where#

The where keyword allows to control the transition point of the step along the x-axis.

import hvplot.pandas  # noqa
import pandas as pd

df = pd.DataFrame({"y": [0, 1, 2]})

df.hvplot.step(where="pre", color="blue", label="pre", alpha=.5) *\
df.hvplot.step(color="red", label="mid (default)", alpha=.5) *\
df.hvplot.step(where="post", color="green", label="post", alpha=.5) *\
df.hvplot.scatter(color="black", padding=0.1)
This web page was generated from a Jupyter notebook and not all interactivity will work on this website.