Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fixed bug streaming SpreadPlot data (#2951)
  • Loading branch information
philippjfr committed Oct 25, 2018
1 parent 65fdb10 commit 49ec63a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
2 changes: 2 additions & 0 deletions holoviews/plotting/bokeh/chart.py
Expand Up @@ -482,6 +482,8 @@ class SpreadPlot(ElementPlot):
style_opts = line_properties + fill_properties
_plot_methods = dict(single='patch')

_stream_data = False # Plot does not support streaming data

def get_data(self, element, ranges, style):
mapping = dict(x='x', y='y')
xvals = element.dimension_values(0)
Expand Down
20 changes: 20 additions & 0 deletions tests/plotting/bokeh/testspreadplot.py
@@ -0,0 +1,20 @@
import numpy as np

from holoviews.core.spaces import DynamicMap
from holoviews.element import Spread
from holoviews.streams import Buffer

from .testplot import TestBokehPlot, bokeh_renderer



class TestSpreadPlot(TestBokehPlot):

def test_spread_stream_data(self):
buffer = Buffer({'y': np.array([]), 'yerror': np.array([]), 'x': np.array([])})
dmap = DynamicMap(Spread, streams=[buffer])
plot = bokeh_renderer.get_plot(dmap)
buffer.send({'y': [1, 2, 1, 4], 'yerror': [.5, .2, .1, .5], 'x': [0,1,2,3]})
cds = plot.handles['cds']
self.assertEqual(cds.data['x'], np.array([0., 1., 2., 3., 3., 2., 1., 0.]))
self.assertEqual(cds.data['y'], np.array([0.5, 1.8, 0.9, 3.5, 4.5, 1.1, 2.2, 1.5]))

0 comments on commit 49ec63a

Please sign in to comment.