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

Skip to content

Commit 842a164

Browse files
committed
Updated the alpha/translucent test to also test lines and a mix of
setting alpha via color and via kwarg
1 parent edc48f0 commit 842a164

File tree

7 files changed

+844
-296
lines changed

7 files changed

+844
-296
lines changed
Binary file not shown.

lib/matplotlib/tests/baseline_images/test_axes/test_alpha.svg

Lines changed: 817 additions & 0 deletions
Loading
Binary file not shown.
Binary file not shown.

lib/matplotlib/tests/baseline_images/test_axes/translucent_markers.svg

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

lib/matplotlib/tests/test_axes.py

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1007,19 +1007,35 @@ def test_mollweide_inverse_forward_closure():
10071007
np.testing.assert_array_almost_equal(xy, xy2, 3)
10081008

10091009

1010-
@image_comparison(baseline_images=['translucent_markers'], remove_text=True)
1011-
def test_translucent_markers():
1010+
@image_comparison(baseline_images=['test_alpha'], remove_text=True)
1011+
def test_alpha():
10121012
np.random.seed(0)
10131013
data = np.random.random(50)
10141014

10151015
fig = plt.figure()
10161016
ax = fig.add_subplot(111)
1017-
ax.plot(data, 'D', mfc=[1, 0, 0, .5], markersize=100)
10181017

1019-
1020-
if __name__=='__main__':
1021-
import nose
1022-
nose.runmodule(argv=['-s','--with-doctest'], exit=False)
1018+
# alpha=.5 markers, solid line
1019+
ax.plot(data, '-D', color=[1, 0, 0], mfc=[1, 0, 0, .5],
1020+
markersize=20, lw=10)
1021+
1022+
# everything solid by kwarg
1023+
ax.plot(data + 2, '-D', color=[1, 0, 0, .5], mfc=[1, 0, 0, .5],
1024+
markersize=20, lw=10,
1025+
alpha=1)
1026+
1027+
# everything alpha=.5 by kwarg
1028+
ax.plot(data + 4, '-D', color=[1, 0, 0], mfc=[1, 0, 0],
1029+
markersize=20, lw=10,
1030+
alpha=.5)
1031+
1032+
# everything alpha=.5 by colors
1033+
ax.plot(data + 6, '-D', color=[1, 0, 0, .5], mfc=[1, 0, 0, .5],
1034+
markersize=20, lw=10)
1035+
1036+
# alpha=.5 line, solid markers
1037+
ax.plot(data + 8, '-D', color=[1, 0, 0, .5], mfc=[1, 0, 0],
1038+
markersize=20, lw=10)
10231039

10241040

10251041
@image_comparison(baseline_images=['vline_hline_zorder',
@@ -1050,3 +1066,7 @@ def test_eb_line_zorder():
10501066
ax.axhline(-j, lw=5, color='k', zorder=j)
10511067

10521068
ax.set_title("errorbar zorder test")
1069+
1070+
if __name__=='__main__':
1071+
import nose
1072+
nose.runmodule(argv=['-s','--with-doctest'], exit=False)

0 commit comments

Comments
 (0)