File: test_tooltips_basic.py

package info (click to toggle)
python-mpld3 0.3git%2B20140910dfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 2,808 kB
  • ctags: 1,095
  • sloc: python: 3,595; makefile: 187
file content (23 lines) | stat: -rw-r--r-- 530 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
"""Plot to test line styles"""
import matplotlib.pyplot as plt
import numpy as np
import mpld3
from mpld3 import plugins


def create_plot():
    fig, ax = plt.subplots()
    points = ax.plot(range(10), 'o', ms=20)
    plugins.connect(fig, plugins.PointLabelTooltip(points[0],
                                                   location="top left"))
    return fig


def test_tooltips_basic():
    fig = create_plot()
    html = mpld3.fig_to_html(fig)
    plt.close(fig)


if __name__ == "__main__":
    mpld3.show(create_plot())