Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions lib/matplotlib/tests/test_collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,28 @@ def test_polycollection_close():
ax.set_ylim3d(0, 4)


@check_figures_equal(extensions=["png"])
def test_scalarmap_change_cmap(fig_test, fig_ref):
# Ensure that changing the colormap of a 3D scatter after draw updates the colors.

x, y, z = np.array(list(itertools.product(
np.arange(0, 5, 1),
np.arange(0, 5, 1),
np.arange(0, 5, 1)
))).T
c = x + y

# test
ax_test = fig_test.add_subplot(111, projection='3d')
sc_test = ax_test.scatter(x, y, z, c=c, s=40, cmap='jet')
fig_test.canvas.draw()
sc_test.set_cmap('viridis')

# ref
ax_ref = fig_ref.add_subplot(111, projection='3d')
ax_ref.scatter(x, y, z, c=c, s=40, cmap='viridis')


@image_comparison(['regularpolycollection_rotate.png'], remove_text=True)
def test_regularpolycollection_rotate():
xx, yy = np.mgrid[:10, :10]
Expand Down
Loading