Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Fixed bug streaming SpreadPlot data (#2951)
- Loading branch information
1 parent
65fdb10
commit 49ec63a
Showing
2 changed files
with
22 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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])) |