Holoviews and hvplot made it easy to overlay multiple datasets in plots.
I am trying to make a faceted grid and overlay two datasets.
However, the basic faceted grid from GridSpace created with hvplot do not conform to my expectations. I was trying to emulate xarray’s FacetGrid.
In the example code below I am plotting 3 x 2 grid with data using xarray FacetGrid and hvplot.
The data increase proportionally across the columns and is inverted across the row.
The xarray plot displays the data correctly, showing the data with increasing ranges.
However with the gridspace and hvplot, I am finding that all plots do not share the same range.
Please see the example code below
import numpy as np
import xarray as xr
import holoviews as hv
from holoviews import opts
import hvplot.xarray
hv.extension('matplotlib')
hv.notebook_extension(display_formats=['html', 'svg'])
hv.output(fig='svg')
# Dimensions
reps = xr.DataArray(np.arange(5), dims='reps', name='reps')
horizon = xr.DataArray([1, -1], dims='horizon', name='horizon')
vertical = xr.DataArray(np.arange(1, 4), dims='vertical', name='vertical')
x = xr.DataArray(np.random.randn(len(reps)),
dims=['reps'],
name='x')
y = vertical * horizon * x
y.name = 'y'
# Merge x, y
data = xr.merge([x, y])
# Assign coords
data = data.assign_coords(reps=reps, vertical=vertical, horizon=horizon)
data.plot.scatter(x='x', y='y', row='horizon', col='vertical')
data.hvplot.scatter(x='x', y='y', row='vertical', col='horizon', groupby=[])