Eric Firing wrote:
> Thomas Robitaille wrote:
>> Hello,
>>
>> I was wondering whether there is a way to rotate a grayscale/ 
>> colorscale when using imshow.
>>
>> I have been using PGPLOT (a fortran/c plotting library) for many years  
>> now, and the equivalent to imshow is called PGGRAY (or PGIMAG). One of  
>> the arguments this function takes is a 6-element array TR which is a  
>> transformation matrix. From the PGPLOT documentation:
>>
>> "The transformation matrix TR is used to calculate the world  
>> coordinates of the center of the "cell" that represents each array  
>> element. The world coordinates of the center of the cell corresponding  
>> to array element A(I,J) are given by:
>> X = TR(1) + TR(2)*I + TR(3)*J
>> Y = TR(4) + TR(5)*I + TR(6)*J"
> 
> You could do this with the Axes.pcolormesh method.  You could start with 
> an unrotated grid (generated by meshgrid, for example), apply your 
> rotation, and use that transformed grid in pcolormesh.  Note that 
> pcolormesh requires the grid for the cell boundaries, not centers.
> 

It should work with imshow() as well if you can set the affine component
of the transform to the desired values. Which it looks like you can in
Affine2D(). (The affine matrix is the elements of TR listed above, it
appears.)

I have not tried to do this, however -- just saying that I think it's
possible.

-Andrew

------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to