Beispiel #1
0
 def test_figure(self):
     fig = figure()
     self.assertIsInstance(fig, Plot)
     fig.close()
     fig = figure(FigureClass=self.FIGURE_CLASS)
     self.assertIsInstance(fig, self.FIGURE_CLASS)
     fig.close()
Beispiel #2
0
 def test_figure(self):
     fig = figure()
     self.assertIsInstance(fig, Plot)
     fig.close()
     fig = figure(FigureClass=self.FIGURE_CLASS)
     self.assertIsInstance(fig, self.FIGURE_CLASS)
     fig.close()
Beispiel #3
0
 def test_map_data(self):
     fig = figure()
     ax = fig.gca()
     html = map_data(self.data, ax, 'test.png')
     self.assertTrue(html.startswith('<!doctype html>'))
     html = map_data(self.data, ax, 'test.png', standalone=False)
     self.assertTrue(html.startswith('\n<img src="test.png"'))
Beispiel #4
0
 def test_map_data(self):
     fig = figure()
     ax = fig.gca()
     html = map_data(self.data, ax, 'test.png')
     self.assertTrue(html.startswith('<!doctype html>'))
     html = map_data(self.data, ax, 'test.png', standalone=False)
     self.assertTrue(html.startswith('\n<img src="test.png"'))
Beispiel #5
0
 def test_map_data(self):
     numpy.random.seed(0)
     data = numpy.vstack((numpy.arange(100), numpy.random.random(100)))
     fig = figure()
     ax = fig.gca()
     html = map_data(data, ax, 'test.png')
     assert html.startswith('<!doctype html>')
     html = map_data(data, ax, 'test.png', standalone=False)
     assert html.startswith('\n<img src="test.png"')
Beispiel #6
0
 def test_map_data(self):
     numpy.random.seed(0)
     data = numpy.vstack((numpy.arange(100), numpy.random.random(100)))
     fig = figure()
     ax = fig.gca()
     html = map_data(data, ax, 'test.png')
     assert html.startswith('<!doctype html>')
     html = map_data(data, ax, 'test.png', standalone=False)
     assert html.startswith('\n<img src="test.png"')
Beispiel #7
0
    def test_map_artist(self):
        from bs4 import BeautifulSoup

        # create figure and plot a line
        fig = figure()
        ax = fig.gca()
        line = ax.plot([1, 2, 3, 4, 5])[0]
        data = list(zip(*line.get_data()))

        # create HTML map
        html = map_artist(line, 'test.png')

        # validate HTML map
        soup = BeautifulSoup(html, 'html.parser')
        areas = soup.find_all('area')
        assert len(areas) == 5
        assert sorted([eval(a.attrs['alt']) for a in areas]) == data
Beispiel #8
0
    def test_map_artist(self):
        from bs4 import BeautifulSoup

        # create figure and plot a line
        fig = figure()
        ax = fig.gca()
        line = ax.plot([1, 2, 3, 4, 5])[0]
        data = list(zip(*line.get_data()))

        # create HTML map
        html = map_artist(line, 'test.png')

        # validate HTML map
        soup = BeautifulSoup(html, 'html.parser')
        areas = soup.find_all('area')
        assert len(areas) == 5
        assert sorted([eval(a.attrs['alt']) for a in areas]) == data