Ejemplo n.º 1
0
 def test_distribution_composite_not_filled(self):
     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'))])
Ejemplo n.º 2
0
 def test_distribution_composite(self):
     dist = Distribution(np.array([0, 1, 2]))
     area = Compositor.collapse_element(dist, backend='matplotlib')
     self.assertIsInstance(area, Area)
     self.assertEqual(area.vdims, [Dimension(('Value_density', 'Value Density'))])
Ejemplo n.º 3
0
 def test_bivariate_composite_empty_not_filled(self):
     dist = Bivariate([]).opts(plot=dict(filled=True))
     contours = Compositor.collapse_element(dist, backend='matplotlib')
     self.assertIsInstance(contours, Contours)
     self.assertEqual(contours.vdims, [Dimension('Density')])
     self.assertEqual(len(contours), 0)
Ejemplo n.º 4
0
 def test_bivariate_composite(self):
     dist = Bivariate(np.random.rand(10, 2))
     contours = Compositor.collapse_element(dist)
     self.assertIsInstance(contours, Contours)
     self.assertEqual(contours.vdims, [Dimension('Density')])
Ejemplo n.º 5
0
 def test_bivariate_composite_filled(self):
     dist = Bivariate(np.random.rand(10, 2)).opts(plot=dict(filled=True))
     contours = Compositor.collapse_element(dist, backend='matplotlib')
     self.assertIsInstance(contours, Polygons)
     self.assertEqual(contours.vdims[0].name, 'Density')
Ejemplo n.º 6
0
 def test_bivariate_composite_transfer_opts_with_group(self):
     dist = Bivariate(np.random.rand(10, 2), group='Test').opts(style=dict(cmap='Blues'))
     contours = Compositor.collapse_element(dist)
     opts = Store.lookup_options('matplotlib', contours, 'style').kwargs
     self.assertEqual(opts.get('cmap', None), 'Blues')
Ejemplo n.º 7
0
 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')])
Ejemplo n.º 8
0
 def test_distribution_composite_transfer_opts_with_group(self):
     dist = Distribution(np.array([0, 1, 2]), group='Test').opts(style=dict(color='red'))
     area = Compositor.collapse_element(dist, backend='matplotlib')
     opts = Store.lookup_options('matplotlib', area, 'style').kwargs
     self.assertEqual(opts.get('color', None), 'red')
Ejemplo n.º 9
0
 def test_distribution_composite_custom_vdim(self):
     dist = Distribution(np.array([0, 1, 2]), vdims=['Test'])
     area = Compositor.collapse_element(dist, backend='matplotlib')
     self.assertIsInstance(area, Area)
     self.assertEqual(area.vdims, [Dimension('Test')])
Ejemplo n.º 10
0
 def test_distribution_composite_empty_not_filled(self):
     dist = Distribution([]).opts(plot=dict(filled=False))
     curve = Compositor.collapse_element(dist)
     self.assertIsInstance(curve, Curve)
     self.assertEqual(curve.vdims,
                      [Dimension(('Value_density', 'Value Density'))])
Ejemplo n.º 11
0
 def test_distribution_composite(self):
     dist = Distribution(np.array([0, 1, 2]))
     area = Compositor.collapse_element(dist, backend='matplotlib')
     self.assertIsInstance(area, Area)
     self.assertEqual(area.vdims, [Dimension(('Value_density', 'Density'))])
Ejemplo n.º 12
0
 def test_bivariate_composite_filled(self):
     dist = Bivariate(np.random.rand(10, 2)).opts(plot=dict(filled=True))
     contours = Compositor.collapse_element(dist, backend='matplotlib')
     self.assertIsInstance(contours, Polygons)
     self.assertEqual(contours.vdims[0].name, 'Density')
Ejemplo n.º 13
0
 def test_bivariate_composite(self):
     dist = Bivariate(np.random.rand(10, 2))
     contours = Compositor.collapse_element(dist, backend='matplotlib')
     self.assertIsInstance(contours, Contours)
     self.assertEqual(contours.vdims, [Dimension('Density')])
Ejemplo n.º 14
0
 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')])
Ejemplo n.º 15
0
 def test_distribution_composite_transfer_opts_with_group(self):
     dist = Distribution(np.array([0, 1, 2]), group='Test').opts(style=dict(color='red'))
     area = Compositor.collapse_element(dist, backend='matplotlib')
     opts = Store.lookup_options('matplotlib', area, 'style').kwargs
     self.assertEqual(opts.get('color', None), 'red')
Ejemplo n.º 16
0
 def test_distribution_composite_empty_not_filled(self):
     dist = Distribution([]).opts(plot=dict(filled=False))
     curve = Compositor.collapse_element(dist, backend='matplotlib')
     self.assertIsInstance(curve, Curve)
     self.assertEqual(curve.vdims, [Dimension(('Value_density', 'Density'))])
Ejemplo n.º 17
0
 def test_distribution_composite_custom_vdim(self):
     dist = Distribution(np.array([0, 1, 2]), vdims=['Test'])
     area = Compositor.collapse_element(dist, backend='matplotlib')
     self.assertIsInstance(area, Area)
     self.assertEqual(area.vdims, [Dimension('Test')])
Ejemplo n.º 18
0
 def test_bivariate_composite_transfer_opts_with_group(self):
     dist = Bivariate(np.random.rand(10, 2), group='Test').opts(style=dict(cmap='Blues'))
     contours = Compositor.collapse_element(dist, backend='matplotlib')
     opts = Store.lookup_options('matplotlib', contours, 'style').kwargs
     self.assertEqual(opts.get('cmap', None), 'Blues')
Ejemplo n.º 19
0
 def test_bivariate_composite_custom_vdim(self):
     dist = Bivariate(np.random.rand(10, 2), vdims=['Test'])
     contours = Compositor.collapse_element(dist)
     self.assertIsInstance(contours, Contours)
     self.assertEqual(contours.vdims, [Dimension('Test')])
Ejemplo n.º 20
0
 def test_bivariate_composite_custom_vdim(self):
     dist = Bivariate(np.random.rand(10, 2), vdims=['Test'])
     contours = Compositor.collapse_element(dist, backend='matplotlib')
     self.assertIsInstance(contours, Contours)
     self.assertEqual(contours.vdims, [Dimension('Test')])
Ejemplo n.º 21
0
 def test_bivariate_composite_empty_not_filled(self):
     dist = Bivariate([]).opts(plot=dict(filled=True))
     contours = Compositor.collapse_element(dist)
     self.assertIsInstance(contours, Contours)
     self.assertEqual(contours.vdims, [Dimension('Density')])
     self.assertEqual(len(contours), 0)
Ejemplo n.º 22
0
 def test_distribution_composite_not_filled(self):
     dist = Distribution(np.array([0, 1, 2])).opts(plot=dict(filled=False))
     curve = Compositor.collapse_element(dist)
     self.assertIsInstance(curve, Curve)
     self.assertEqual(curve.vdims, [Dimension(('Value_density', 'Value Density'))])