Skip to content
Open
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
9 changes: 8 additions & 1 deletion geoutils/raster/raster.py
Original file line number Diff line number Diff line change
Expand Up @@ -2161,8 +2161,15 @@ def plot(

# Create colorbar
# Use rcParam default
if cmap is None:
if cmap is None and isinstance(bands, int):
# ONLY set a cmap arg for single band images
cmap = plt.get_cmap(plt.rcParams["image.cmap"])
elif cmap is None and isinstance(bands, tuple):
# Leave cmap as None for multi-band image, because if a cmap
# is passed then imshow treats this as an instruction to apply scalar
# mapping, which is not a desirable behaviour (it can result in color-casted
# RGB images for example).
pass
elif isinstance(cmap, str):
cmap = plt.get_cmap(cmap)
elif isinstance(cmap, matplotlib.colors.Colormap):
Expand Down
Loading