Skip to content

Commit 4e1cb12

Browse files
saitcakmakfacebook-github-bot
authored andcommitted
Replace deprecated plt.cm.get_cmap in tutorials (#2347)
Summary: `plt.cm.get_cmap` has been deprecated since v3.7 and got fully removed in v3.9: https://matplotlib.org/3.8.4/api/cm_api.html#matplotlib.cm.get_cmap A recent failure caused by this: https://github.com/pytorch/botorch/actions/runs/9122432682 `plt.get_cmap` lives on with no deprecation notice according to v3.10 development docs: https://matplotlib.org/devdocs/api/_as_gen/matplotlib.pyplot.get_cmap.html Pull Request resolved: #2347 Test Plan: The tutorials CI job passes. Reviewed By: dme65 Differential Revision: D57476779 Pulled By: saitcakmak fbshipit-source-id: fe61c459c4e395f1c7714b449d2be5b13b2c9d15
1 parent 27696a3 commit 4e1cb12

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

tutorials/constrained_multi_objective_bo.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -637,7 +637,7 @@
637637
"output_type": "stream",
638638
"text": [
639639
"/var/folders/_j/_hhj7k4913d4jlzgq92bw9b00000gn/T/ipykernel_16702/4269187899.py:7: MatplotlibDeprecationWarning: The get_cmap function was deprecated in Matplotlib 3.7 and will be removed two minor releases later. Use ``matplotlib.colormaps[name]`` or ``matplotlib.colormaps.get_cmap(obj)`` instead.\n",
640-
" cm = plt.cm.get_cmap(\"viridis\")\n"
640+
" cm = plt.get_cmap(\"viridis\")\n"
641641
]
642642
},
643643
{
@@ -668,7 +668,7 @@
668668
"\n",
669669
"fig, axes = plt.subplots(1, 3, figsize=(17, 5))\n",
670670
"algos = [\"Sobol\", \"qParEGO\", \"qNEHVI\"]\n",
671-
"cm = plt.cm.get_cmap(\"viridis\")\n",
671+
"cm = plt.get_cmap(\"viridis\")\n",
672672
"\n",
673673
"batch_number = torch.cat(\n",
674674
" [\n",

tutorials/multi_objective_bo.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -710,7 +710,7 @@
710710
"\n",
711711
"fig, axes = plt.subplots(1, 4, figsize=(23, 7), sharex=True, sharey=True)\n",
712712
"algos = [\"Sobol\", \"qNParEGO\", \"qEHVI\", \"qNEHVI\"]\n",
713-
"cm = plt.cm.get_cmap(\"viridis\")\n",
713+
"cm = plt.get_cmap(\"viridis\")\n",
714714
"\n",
715715
"batch_number = torch.cat(\n",
716716
" [\n",

0 commit comments

Comments
 (0)