Skip to content
Permalink
Browse files

Updated contours tests

  • Loading branch information...
philippjfr committed Oct 22, 2018
1 parent 0147b3e commit ff319a6083c55058cc1a939628844a26a93b6be9
@@ -143,7 +143,7 @@ def test_distribution_composite_custom_vdim(self):
self.assertEqual(area.vdims, [Dimension('Test')])

def test_distribution_composite_not_filled(self):
dist = Distribution(np.array([0, 1, 2])).opts(plot=dict(filled=False))
dist = Distribution(np.array([0, 1, 2]), ).opts(plot=dict(filled=False))
curve = Compositor.collapse_element(dist, backend='matplotlib')
self.assertIsInstance(curve, Curve)
self.assertEqual(curve.vdims, [Dimension(('Value_density', 'Value Density'))])
@@ -182,7 +182,7 @@ def test_bivariate_composite_filled(self):
dist = Bivariate(np.random.rand(10, 2)).opts(plot=dict(filled=True))
contours = Compositor.collapse_element(dist)
self.assertIsInstance(contours, Polygons)
self.assertEqual(contours.vdims, [Dimension('Density', range=(0, 1.1))])
self.assertEqual(contours.vdims[0].name, 'Density')

def test_bivariate_composite_empty_filled(self):
dist = Bivariate([]).opts(plot=dict(filled=True))
@@ -61,15 +61,15 @@ def test_bivariate_kde_contours(self):
kde = bivariate_kde(bivariate, n_samples=100, x_range=(0, 1),
y_range=(0, 1), contours=True, levels=10)
self.assertIsInstance(kde, Contours)
self.assertEqual(len(kde.data), 9)
self.assertEqual(len(kde.data), 6)

def test_bivariate_kde_contours_filled(self):
np.random.seed(1)
bivariate = Bivariate(np.random.rand(100, 2))
kde = bivariate_kde(bivariate, n_samples=100, x_range=(0, 1),
y_range=(0, 1), contours=True, filled=True, levels=10)
self.assertIsInstance(kde, Polygons)
self.assertEqual(len(kde.data), 10)
self.assertEqual(len(kde.data), 7)

def test_bivariate_kde_nans(self):
kde = bivariate_kde(self.bivariate_nans, n_samples=2, x_range=(0, 4),

0 comments on commit ff319a6

Please sign in to comment.
You can’t perform that action at this time.