Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __init__(self, data, kind=None, by=None, width=800,
height=300, backlog=1000, shared_axes=False,
grid=False, legend=True, rot=None, title=None,
xlim=None, ylim=None, xticks=None, yticks=None,
fontsize=None, colormap=None, stacked=False,
logx=False, logy=False, loglog=False, hover=False,
**kwds):
# Set up HoloViews stream
if isinstance(data, (Series, Seriess)):
data = data.to_frame()
self.data = data
self.stream_type = data._stream_type
if data._stream_type == 'updating':
self.stream = Pipe(data=data.example)
else:
self.stream = Buffer(data.example, length=backlog)
data.stream.gather().sink(self.stream.send)
# High-level options
self.by = by
self.stacked = stacked
self.kwds = kwds
# Process style options
if 'cmap' in kwds and colormap:
def is_series(data):
if not check_library(data, ['dask', 'streamz', 'pandas']):
return False
elif isinstance(data, pd.Series):
return True
elif check_library(data, 'streamz'):
import streamz.dataframe as sdf
return isinstance(data, (sdf.Series, sdf.Seriess))
elif check_library(data, 'dask'):
import dask.dataframe as dd
return isinstance(data, dd.Series)
else:
return False
return self(kind='table', **kwds)
# Register plotting interfaces
def df_plot(self):
return HoloViewsFramePlot(self)
def series_plot(self):
return HoloViewsSeriesPlot(self)
DataFrame.plot = property(df_plot)
DataFrames.plot = property(df_plot)
Series.plot = property(series_plot)
Seriess.plot = property(series_plot)
hv.extension('bokeh')
def patch(name='hvplot', extension='bokeh', logo=False):
from . import hvPlotTabular, post_patch
try:
import streamz.dataframe as sdf
except ImportError:
raise ImportError('Could not patch plotting API onto streamz. '
'Streamz could not be imported.')
_patch_plot = lambda self: hvPlotTabular(self)
_patch_plot.__doc__ = hvPlotTabular.__call__.__doc__
patch_property = property(_patch_plot)
setattr(sdf.DataFrame, name, patch_property)
setattr(sdf.DataFrames, name, patch_property)
setattr(sdf.Series, name, patch_property)
setattr(sdf.Seriess, name, patch_property)
post_patch(extension, logo)