Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f641d33

Browse files
committed
Move auto_legend.py tests into regression test framework.
1 parent 2b79fe4 commit f641d33

8 files changed

Lines changed: 1604 additions & 82 deletions

File tree

Binary file not shown.
20.6 KB
Loading

lib/matplotlib/tests/baseline_images/test_legend/legend_auto1.svg

Lines changed: 504 additions & 0 deletions
Loading
Binary file not shown.
16.2 KB
Loading

lib/matplotlib/tests/baseline_images/test_legend/legend_auto2.svg

Lines changed: 1071 additions & 0 deletions
Loading
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import numpy as np
2+
3+
from matplotlib.testing.decorators import image_comparison, knownfailureif
4+
import matplotlib.pyplot as plt
5+
from nose.tools import assert_raises
6+
from numpy.testing import assert_array_equal
7+
8+
@image_comparison(baseline_images=['legend_auto1'])
9+
def test_legend_auto1():
10+
'Test automatic legend placement'
11+
fig = plt.figure()
12+
ax = fig.add_subplot(111)
13+
x = np.arange(100)
14+
ax.plot(x, 50-x, 'o', label='y=1')
15+
ax.plot(x, x-50, 'o', label='y=-1')
16+
ax.legend(loc=0)
17+
fig.savefig('legend_auto1')
18+
19+
@image_comparison(baseline_images=['legend_auto2'])
20+
def test_legend_auto2():
21+
'Test automatic legend placement'
22+
fig = plt.figure()
23+
ax = fig.add_subplot(111)
24+
x = np.arange(100)
25+
b1 = ax.bar(x, x, color='m')
26+
b2 = ax.bar(x, x[::-1], color='g')
27+
ax.legend([b1[0], b2[0]], ['up', 'down'], loc=0)
28+
fig.savefig('legend_auto2')
29+

unit/auto_legend.py

Lines changed: 0 additions & 82 deletions
This file was deleted.

0 commit comments

Comments
 (0)