You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug earthpy.plot.plot_bands method ignores ax keyword argument if raster has multiple bands
To Reproduce
Steps to reproduce the behavior:
If raster is an array with raster.ndim > 2 and raster.shape[0] > 1, then the ax keyword
argument has no effect and the plot_bands method produces a new axes array. The user has
no access to the figure object to customize the plot.
import earthpy.plot as ep
import matplotlib.pyplot as plt
fig, axs = plt.subplots(3, 1)
ep.plot_bands(raster, ax=axs)
will produce an output that looks like
Expected behavior
Ideally, if an axis grid consistent with the number of bands is passed in the ax keyword argument, the method would use these axes objects as expected. If this is not feasible, an error message indicating that the ax keyword is not supported when multi-band arrays are provided is needed to avoid confusion.
**What Operating System Are you Running? **
Mac
The text was updated successfully, but these errors were encountered:
ahasha
added a commit
to ahasha/earthpy
that referenced
this issue
Nov 18, 2022
* Added logic to earthpy.plot.plot_bands to validate dimensions of
ax array, if provided, when raster array is multiband.
Raises a ValueError if the provided axes array is smaller
than the number of bands.
* Added a test for the success and failure states.
Hey @ahasha! Seeing this now, the solution on your branch looks awesome. A PR would be very welcome, might ask for some changes before I merge it but go ahead and get it started!
Describe the bug
earthpy.plot.plot_bands
method ignoresax
keyword argument if raster has multiple bandsTo Reproduce
Steps to reproduce the behavior:
If
raster
is an array withraster.ndim > 2
andraster.shape[0] > 1
, then theax
keywordargument has no effect and the
plot_bands
method produces a new axes array. The user hasno access to the figure object to customize the plot.
will produce an output that looks like
Expected behavior
Ideally, if an axis grid consistent with the number of bands is passed in the
ax
keyword argument, the method would use these axes objects as expected. If this is not feasible, an error message indicating that theax
keyword is not supported when multi-band arrays are provided is needed to avoid confusion.**What Operating System Are you Running? **
The text was updated successfully, but these errors were encountered: