You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Given an xarray.Dataset that contains multiple data variables and a coordinate with "long_name" and/or "units" attributes, a multi-element plot created from that dataset labels the coordinate with only the coordinate's name instead of its long name and units:
In [1]: importholoviews, hvplot.xarray, xarrayIn [2]: dset=xarray.Dataset(
...: {"u": ("t", [1, 3]), "v": ("t", [4, 2])},
...: coords={"t": ("t", [0, 1], {"long_name": "time", "units": "s"})},
...: )
In [3]: ndoverlay=dset.hvplot.line()
In [4]: ndoverlay.ddims[0]
Out[4]: Dimension('t')
In [5]: holoviews.render(ndoverlay).xaxis.axis_labelOut[5]: 't'
The same is true for an NdLayout returned by dset.hvplot.line(subplots=True).
In contrast, a single-element plot created from one data variable has coordinates labeled with the long name and units:
In [6]: curve=dset["u"].hvplot.line()
In [7]: curve.kdims[0]
Out[7]: Dimension('t', label='time', unit='s')
In [8]: holoviews.render(curve).xaxis.axis_labelOut[8]: 'time (s)'
Similarly, a single-element bar plot dset.hvplot.bar() of both variables in the dataset honors the long name and units:
In [9]: dset.hvplot.bar().kdims[0]
Out[9]: Dimension('t', label='time', unit='s')
A possible cause is that, whereas the HoloViewsConverter.single_chart and other plot methods apply the long name and units stored in self._redim by calling the redim(**self._redim) method on the chart [code], the HoloViewsConverter.chart method lacks such a call for the multi-element case [code]. Could the call be included in the HoloViewsConverter.chart method?
To work around the difference, the user may re-dimension the returned overlay, although converting the attributes from the dataset is a bit verbose:
Relevant software versions are collapsed here.
Given an
xarray.Dataset
that contains multiple data variables and a coordinate with "long_name" and/or "units" attributes, a multi-element plot created from that dataset labels the coordinate with only the coordinate's name instead of its long name and units:The same is true for an
NdLayout
returned bydset.hvplot.line(subplots=True)
.In contrast, a single-element plot created from one data variable has coordinates labeled with the long name and units:
Similarly, a single-element bar plot
dset.hvplot.bar()
of both variables in the dataset honors the long name and units:A possible cause is that, whereas the
HoloViewsConverter.single_chart
and other plot methods apply the long name and units stored inself._redim
by calling theredim(**self._redim)
method on the chart [code], theHoloViewsConverter.chart
method lacks such a call for the multi-element case [code]. Could the call be included in theHoloViewsConverter.chart
method?To work around the difference, the user may re-dimension the returned overlay, although converting the attributes from the dataset is a bit verbose:
The text was updated successfully, but these errors were encountered: