Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!

import pandas as pd
import holoviews as hv

hv.extension("bokeh")
Loading...
Loading...
Loading...
daily = pd.read_csv("../../home/media/data/daily.csv")
daily.head()
Loading...

Setting the Dimension Ranges Explicitly¶

%%opts Scatter [width=600 height=500 scaling_method='width' scaling_factor=2 size_index=2 show_grid=True] 

xdim = hv.Dimension('x', range=(0, 45000))
ydim = hv.Dimension('y', range=(0, 800000))
hv.Scatter((daily.x, daily.y), xdim, ydim)
Loading...

Using redim.range

Notice that the keyword names in redim.range must match the specified dimension names.

%%opts Scatter [width=600 height=500 scaling_method='width' scaling_factor=2 size_index=2 show_grid=True] 

hv.Scatter((daily.x, daily.y), 'x', 'y').redim.range(x=(0, 45000), y=(0, 800000))
Loading...

Use options

options is the easiest way to change axis ranges. When there are multiple subplots, you have to either set different dimension names or use the option axiswise=True.

%%opts Scatter [width=600 height=500 scaling_method='width' scaling_factor=2 size_index=2 show_grid=True] 

hv.Scatter((daily.x, daily.y)).options(xlim=(0, 45000), ylim=(0, 800000))
Loading...
%%opts Scatter [width=400 height=400 scaling_method='width' scaling_factor=2 size_index=2 show_grid=True] 

hv.Scatter((daily.x, daily.z), 'x', 'z') + \
hv.Scatter((daily.x, daily.y)).options(xlim=(0, 45000), ylim=(0, 800000))
Loading...

Use axiswise=True for it to work when the dimensions of subplots are identical.

%%opts Scatter [width=400 height=400 scaling_method='width' scaling_factor=2 size_index=2 show_grid=True] 

hv.Scatter((daily.x, daily.z), 'x', 'y') + \
hv.Scatter((daily.x, daily.y), 'x', 'y').options(xlim=(0, 45000), ylim=(0, 800000), axiswise=True)
Loading...
%%opts Scatter [width=400 height=400 scaling_method='width' scaling_factor=2 size_index=2 show_grid=True] 

hv.Scatter((daily.x, daily.z)).options(axiswise=True) + \
hv.Scatter((daily.x, daily.y)).options(axiswise=True)
Loading...
%%opts Layout [shared_axes=False]

hv.Scatter((daily.x, daily.z)).options(axiswise=True) + hv.Scatter((daily.x, daily.y)).options(axiswise=True)
Loading...