Closed leatkinson closed 6 years ago
the problem is that plot doesn’t care when there’s more than one band:
if self.shape[0] == 1 or ("bands" in kwargs and len(kwargs["bands"]) == 1):
if "cmap" in kwargs:
cmap = kwargs["cmap"]
del kwargs["cmap"]
else:
cmap = "Greys_r"
self._plot(tfm=self._single_band, cmap=cmap, **kwargs)
return
else:
if spec == "rgb" and self._has_token(**kwargs) and False:
self._plot(tfm=self.base_layer_match, **kwargs)
else:
self._plot(tfm=getattr(self, spec), **kwargs)
so it gets to if spec=="rgb"
, which it does by default… tries to match baselayers, etc all the while passing the bands argument.
To fix this we have to figure out what this means: img.plot(bands=[1,2,3,4,5,6,7,8])
perhaps we introduce something like def show(self, as_image=False, ...)
where it takes bands and makes a subplot array when as_image is False, but when true, it operates on all the bands together in the generic euclidean fashion to produce one image in the same way the imshow
does. Suggestions welcome.
im not sure i dig having too many more methods for dealing with plotting, i'd prefer to keep just a single plot method and hope that users become more competent in plotting the raw data etc on their own.
In the case of img.plot(bands=[1,2,3,4,5,6,7,8])
we plot rgb.
the origin intent of image.plot(bands=[6,2,1])
and/or image.plot(bands=[3])
needs to absolutely work. After that we could discuss support specific specs like false_color etc.
fixed via #351
When trying plot an image with a different band combination using the bands parameter I get an Index out of bounds error. An example of this error can be found in this notebook. https://notebooks.geobigdata.io/hub/notebooks/5b2ac7332c7831647a307034?tab=code
This is the stack trace I receive: ` IndexErrorTraceback (most recent call last)