Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
dmap = DynamicMap(lambda N: Curve([1, N, 5]), kdims=dims)
initialize_dynamic(dmap)
def test_overlay_legend(self):
overlay = Curve(range(10), label='A') * Curve(range(10), label='B')
plot = bokeh_renderer.get_plot(overlay)
legend_labels = [l.label['value'] for l in plot.state.legend[0].items]
self.assertEqual(legend_labels, ['A', 'B'])
def history_callback(x, history=deque(maxlen=10)):
history.append(x)
return Curve(list(history))
def test_element_no_yaxis(self):
curve = Curve(range(10)).opts(plot=dict(yaxis=None))
plot = bokeh_renderer.get_plot(curve).state
self.assertFalse(plot.yaxis[0].visible)
def callback(i):
return NdLayout({j: Curve([], label=str(j)) for j in range(i, i+2)})
dmap = DynamicMap(callback, kdims=['i']).redim.range(i=(0, 10))
def callback(x): return Curve([1,2,3])
xval = Stream.define('x',x=0)()
def test_curve_datetime64(self):
dates = [np.datetime64(dt.datetime(2016,1,i)) for i in range(1, 11)]
curve = Curve((dates, np.random.rand(10)))
plot = bokeh_renderer.get_plot(curve)
self.assertEqual(plot.handles['x_range'].start, np.datetime64(dt.datetime(2016, 1, 1)))
self.assertEqual(plot.handles['x_range'].end, np.datetime64(dt.datetime(2016, 1, 10)))
hmap = DynamicMap(lambda x: Curve([1, 2, 3]), kdims=[dimension])
widgets = bokeh_renderer.get_widget(hmap, 'widgets')
def test_curve_categorical_xaxis_invert_axes(self):
curve = Curve((['A', 'B', 'C'], (1,2,3))).opts(plot=dict(invert_axes=True))
plot = bokeh_renderer.get_plot(curve)
y_range = plot.handles['y_range']
self.assertIsInstance(y_range, FactorRange)
self.assertEqual(y_range.factors, ['A', 'B', 'C'])
'contour' : ['z', 'levels', 'logz'],
'contourf' : ['z', 'levels', 'logz'],
'vectorfield': ['angle', 'mag'],
'points' : ['s', 'marker', 'c', 'scale', 'logz'],
'polygons' : ['logz', 'c'],
'labels' : ['text', 'c', 's'],
'kde' : ['bw_method', 'ind'],
}
_kind_mapping = {
'line': Curve, 'scatter': Scatter, 'heatmap': HeatMap,
'bivariate': Bivariate, 'quadmesh': QuadMesh, 'hexbin': HexTiles,
'image': Image, 'table': Table, 'hist': Histogram, 'dataset': Dataset,
'kde': Distribution, 'density': Distribution, 'area': Area, 'box': BoxWhisker, 'violin': Violin,
'bar': Bars, 'barh': Bars, 'contour': Contours, 'contourf': Polygons,
'points': Points, 'polygons': Polygons, 'paths': Path, 'step': Curve,
'labels': Labels, 'rgb': RGB, 'errorbars': ErrorBars,
'vectorfield': VectorField,
}
_colorbar_types = ['image', 'hexbin', 'heatmap', 'quadmesh', 'bivariate',
'contour', 'contourf', 'polygons']
_legend_positions = ("top_right", "top_left", "bottom_left",
"bottom_right", "right", "left", "top",
"bottom")
_default_plot_opts = {
'logx': False, 'logy': False, 'show_legend': True, 'legend_position': 'right',
'show_grid': False, 'responsive': False, 'shared_axes': True}
_default_cmaps = {