Skip to content

Commit 33d2069

Browse files
committed
Testing 2d to 1d conversion function in
colors.to_rgba()
1 parent 0a57fdf commit 33d2069

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lib/matplotlib/tests/test_colors.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1175,3 +1175,10 @@ def test_get_under_over_bad():
11751175
assert_array_equal(cmap.get_under(), cmap(-np.inf))
11761176
assert_array_equal(cmap.get_over(), cmap(np.inf))
11771177
assert_array_equal(cmap.get_bad(), cmap(np.nan))
1178+
1179+
1180+
def test_2d_to_rgba():
1181+
color = np.array([0.1, 0.2, 0.3])
1182+
rgba_1d = mcolors.to_rgba(color.reshape((-1)))
1183+
rgba_2d = mcolors.to_rgba(color.reshape((1, -1)))
1184+
assert rgba_1d == rgba_2d

0 commit comments

Comments
 (0)