forked from plotly/plotly.py
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_scatter.py
More file actions
31 lines (26 loc) · 1.19 KB
/
Copy pathtest_scatter.py
File metadata and controls
31 lines (26 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import matplotlib.pyplot as plt
from .nose_tools import compare_dict, run_fig
from .data.scatter import *
def test_simple_scatter():
fig, ax = plt.subplots()
ax.scatter(D['x1'], D['y1'])
renderer = run_fig(fig)
for data_no, data_dict in enumerate(renderer.plotly_fig['data']):
equivalent, msg = compare_dict(data_dict,
SIMPLE_SCATTER['data'][data_no])
assert equivalent, msg
equivalent, msg = compare_dict(renderer.plotly_fig['layout'],
SIMPLE_SCATTER['layout'])
assert equivalent, msg
def test_double_scatter():
fig, ax = plt.subplots()
ax.scatter(D['x1'], D['y1'], color='red', s=121, marker='^', alpha=0.5)
ax.scatter(D['x2'], D['y2'], color='purple', s=64, marker='s', alpha=0.5)
renderer = run_fig(fig)
for data_no, data_dict in enumerate(renderer.plotly_fig['data']):
equivalent, msg = compare_dict(data_dict,
DOUBLE_SCATTER['data'][data_no])
assert equivalent, msg
equivalent, msg = compare_dict(renderer.plotly_fig['layout'],
DOUBLE_SCATTER['layout'])
assert equivalent, msg