Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle nans in bokeh Area and Spread plots
- Loading branch information
1 parent
df665cc
commit c55b044
Showing
3 changed files
with
81 additions
and
20 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,24 @@ | ||
import numpy as np | ||
|
||
from holoviews.element import Area | ||
|
||
from .testplot import TestBokehPlot, bokeh_renderer | ||
|
||
|
||
class TestAreaPlot(TestBokehPlot): | ||
|
||
def test_area_with_nans(self): | ||
area = Area([1, 2, 3, np.nan, 5, 6, 7]) | ||
plot = bokeh_renderer.get_plot(area) | ||
cds = plot.handles['cds'] | ||
self.assertEqual(cds.data['x'], np.array([0., 1., 2., 2., 1., 0., np.nan, | ||
4., 5., 6., 6., 5., 4.])) | ||
self.assertEqual(cds.data['y'], np.array([0., 0., 0., 3., 2., 1., np.nan, | ||
0., 0., 0., 7., 6., 5.])) | ||
|
||
def test_area_empty(self): | ||
area = Area([]) | ||
plot = bokeh_renderer.get_plot(area) | ||
cds = plot.handles['cds'] | ||
self.assertEqual(cds.data['x'], []) | ||
self.assertEqual(cds.data['y'], []) |
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