Tony S Yu wrote:
>
> On Jun 30, 2008, at 11:13 AM, Michael Droettboom wrote:
>> transScale is where all of the (optionally) logarithmic 
>> transformation takes place.  I'm surprised
>>
>> >>> transDesired = self.transScale + self.transLimits
>>
>> didn't work for going from data to a (0, 0) - (1, 1) bounding box. 
>>  Can you provide a small, yet complete, example that illustrates the 
>> bug so I can look at it further?
>
> I tried to put together a simple example showing my problem, but the 
> example worked properly! Doh!
>
> It turns out that my problem was specific to using a bounding box as 
> an input to transform:
>
> =========
> from numpy.random import rand
> import matplotlib.pyplot as plt
>
> ax = plt.subplot(111)
> xy = rand(5,2)
> ax.loglog(xy[:, 0], xy[:, 1], 'ro')
>
> trans = ax.transScale + ax.transLimits
> result = trans.transform(ax.dataLim) 
> =========
>
> The above command gives me:
> *    TypeError:* 'Bbox' object is unsubscriptable
> (Note, if I call `plot` instead of `loglog` I don't have problems). 
> The quick solution is to replace the last line with
>
> >>> result = trans.transform(ax.dataLim._points)
>
> I guess I was confused because the transform worked fine with `plot`. 
> Is the TypeError above expected behavior?
>
Yes.  The "transform" method is meant to take an Nx2 array, it doesn't 
take a bounding box.  I think it probably works with non-log plots only 
by accident because bounding boxes can cast to arrays in some cases.  It 
may be worth taking that out to avoid confusion, but I'll have to think 
on it some.

Thanks for looking into this!

Mike

-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to