From: Stephen W. <ste...@cs...> - 2005-06-15 22:56:06
|
Perry Greenfield wrote: > On Jun 14, 2005, at 7:30 PM, Stephen Walton wrote: > >> 1. Is anyone else bothered by the fact that imshow(array) displays >> array[i,j] at Cartesian coordinates [j,shape(array)[0]-i] if origin >> is 'upper' and at [j,i] if origin is 'lower'? > > As with John, I'm not sure what the complaint is. Perry is correct that it is likely my main problem is that the order of indices of astronomical FITS images is reversed when read in via PyFITS. He has commented on that issue extensively today over on the AstroPy mailing list, so I won't belabor the point here as it is not directly relevant to matplotlib anyway. > Is it that the order is j,i or that lower and upper are defined the > way they are. If the latter, I'm not sure what was expected. I do understand John's desire to have a displayed image appear in the same orientation as a list of pixels on the screen. But I want to be able to easily read image coordinates from a display and use them to address the underlying data. The Cartesian coordinates are displayed as (x,y) when one rolls the mouse pointer over the image, and so you have to reverse them, plus if origin='upper' you have to flip the y coordinate (image.shape[0]-y). Specific suggestion: when an array is displayed with origin='upper', the y axis should increase downward, not upward. At least this way, pixel [i,j] always appears at Cartesian coordinates (j,i) and a program which, for example, overlays points plotted as (x,y) on an image won't break if a user changes image.origin in the .matplotlibrc file. John asked what MATLAB does at present. The answer is: MATLAB's image() displays arrays as does imshow(origin='upper'), with first index increasing downward and second index increasing left to right, but it has the y axis increasing from top to bottom. |