errors=panic is a user on cybre.space. You can follow them or interact with them if you have an account anywhere in the fediverse.
errors=panic @minx

Ok, is there a good reason I'm missing why matplotlib.imshow complains when I give it an ndarray with shape (x,y,1) instead of the same array squeeze'd down to (x,y)?

I mean, I realize that they are not ACTUALLY the same thing, but treating them differently for the purpose of plotting values graphically seems kinda stupid.

Is this just being its usual user-hostile self?

· Web · 0 · 0

@minx how would it know where the data are to plot if both the number of dimensions and their sizes were arbitrary? An x axis of size 1 may certainly be plottable. And truly redundant size 1 dimensions are often the first or second dimensions, with x and y following them.

@tammas Eh, unconvinced.

Since it already makes the assumption that 3D arrays with a third dimension of sizes 3 and 4 are RGB and RGBA images, it could just as well make the assumption that a 3D array with a third dimension of size 1 would be something similarly plottable and treat it as a 2D array.

@minx I guess so. Maybe make an issue or pull request on github? See what they say.

@minx I feel like they might say it's a specific enough assumption that it wouldn't make it any more user friendly, or they might think it's unconventional. Who knows.