Skip to content

Commit

Permalink
MDAS: silence matplotlib deprecation warning
Browse files Browse the repository at this point in the history
  • Loading branch information
adamjstewart committed Jan 27, 2025
1 parent 8a3b60d commit bb96d10
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions torchgeo/datasets/mdas.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
from collections.abc import Callable
from typing import Any, ClassVar

import matplotlib.cm as cm
import matplotlib.pyplot as plt
import numpy as np
import rasterio as rio
import torch
from matplotlib.colormaps import get_cmap
from matplotlib.colors import ListedColormap
from matplotlib.figure import Figure
from torch import Tensor
Expand Down Expand Up @@ -356,7 +356,7 @@ def plot(
axs[idx].imshow(img)
case 'osm_landuse_mask':
img = data.numpy().squeeze(0)
cmap = ListedColormap([cm.get_cmap('tab20')(i) for i in range(20)])
cmap = ListedColormap([get_cmap('tab20')(i) for i in range(20)])
im = axs[idx].imshow(img, cmap=cmap)
cbar = plt.colorbar(im, ax=axs[idx], ticks=range(19))
cbar.ax.set_yticklabels(
Expand Down

0 comments on commit bb96d10

Please sign in to comment.