Skip to content
Merged
Changes from 1 commit
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
4 changes: 2 additions & 2 deletions cirq-core/cirq/vis/heatmap_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def test_cell_colors(ax, colormap_name):
)
_, mesh = random_heatmap.plot(ax)

colormap = mpl.cm.get_cmap(colormap_name)
colormap = mpl.colormaps.get_cmap(colormap_name)
for path, facecolor in zip(mesh.get_paths(), mesh.get_facecolors()):
vertices = path.vertices[0:4]
row = int(round(np.mean([v[1] for v in vertices])))
Expand Down Expand Up @@ -218,7 +218,7 @@ def __format__(self, format_string):

_, mesh = random_heatmap.plot(ax)

colormap = mpl.cm.get_cmap(colormap_name)
colormap = mpl.colormaps.get_cmap(colormap_name)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional: Issue matplotlib/matplotlib#20853 suggests we should perhaps just say

colormap = mpl.colormaps[colormap_name]

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Maybe this will work in python 3.7 too.

for path, facecolor in zip(mesh.get_paths(), mesh.get_facecolors()):
vertices = path.vertices[0:4]
row = int(round(np.mean([v[1] for v in vertices])))
Expand Down