Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed bug streaming SpreadPlot data #2951

Merged
merged 1 commit into from Aug 20, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions holoviews/plotting/bokeh/chart.py
Expand Up @@ -483,6 +483,8 @@ class SpreadPlot(ElementPlot):
style_opts = line_properties + fill_properties
_plot_methods = dict(single='patch')

_stream_data = False # Plot does not support streaming data
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was very confusing until I realized this might refer to the bokeh use of the word 'streaming'.


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]))