I am rendering a time series using hvplot.line. When zooming in on the plot, I noticed some of the lines were disappearing where there should be data points. The lines are disappearing as the zoom increases. How can I control or avoid that?
This behavior is more clear when overlaying line- and scatter-plots of the same dataset.
The following code should reproduce the issue:
import xarray as xr
import holoviews as hv
import hvplot.xarray
url = "https://thredds.met.no/thredds/dodsC/alertness/YOPP_supersite/obs/utqiagvik/utqiagvik_obs_timeSeries_20180701_20180930.nc"
ds = xr.open_dataset(url)
# the following line plot which has data disappearing as we zoom in
ds['snd'].hvplot.line(x='time01')
# overlay showing missing data points in the line plot:
hv.Overlay([ds['snd'].hvplot.line(x='time01'),
ds['snd'].hvplot.scatter(x='time01')]).opts(show_grid=True)
It seems the issue is related to the Y limit on the plot - when I fine tune the Y zoom to let the data “fit” in the plot canvas, then all the points are connected and the line plot is representative of the dataset - otherwise, the line plot is removing lines where actual data exist.
Yes, that is exactly it! Thank you so much for clarifying the behavior. It is intuitive and visible when there is a large gap large data - gap in the data, but It is somehow confusing to see lines disappearing when zooming in. If I understood, this means that the line is shown because there is a sort of downsampling when zoomed out? why if I “adjust” the y-lim in the plot the NaN is ignored and a line is plotted?
Wonderful! Thank you so much for your help.
I am running:
Python 3.11.6 | packaged by conda-forge | (main, Oct 3 2023, 10:40:35) [GCC 12.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import bokeh
>>> bokeh.__version__
'3.3.3'
I will try to install the 3.4.0.dev5 version and see if that fixes it.