|
From: Tony S Yu <to...@MI...> - 2008-06-30 16:16:09
|
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?
Thanks for your help.
-Tony
|