[wxPython-users] FloatCanvas x/y scaling question
Christopher Barker
Chris.Barker at noaa.gov
Thu Apr 12 12:35:24 PDT 2007
Grant,
if we get into much more detail, we might want to move the thread over =
to the FloatCanvas mailing list. I've cc'd that list, as I like to have =
this sort of thing archived.
Grant Edwards wrote:
> In a FloatCanvas, I can't seem to find a way to unlock the x
> scaling and the y scaling. Is that not possible?
oddly enough, I don't think anyone has had the need for this yet...
> Does one use a projection function for that? =
That should be able to do it.
> I'm plotting a triangulation where the x values range from
> 50e-6 to 2000e-6, and the y values range from 0 to 50000, so
> having the x and y scaled the same doesn't produce very useful
> results. ;)
I'm trying to figure out what what delauney triangulation means when x =
and y have different units...nevertheless,
> If so, what is the API for a projection function?
> Google wasn't able to find any examples or docs for a projection
> function.
Do you have the new distro? (rather than the one built in to wx.lib?) It =
has at least one example: YDownDemo.py
The api is:
a projection function takes the (x,y) coords of the center of the =
viewport, and returns a (Xscale, Yscale) vector that, when multiplied by =
a NX2 numpy array of (x,y) points, give the desired values.
clear as mud?
In your case, I think you want something like:
def YScaleFun(center):
"""
function that returns a scaling vector to scale y data to same =
range as x data
"""
#center gets ignored in this case
return N.array((5e7, 1), N.float)
example enclosed.
-Chris
-- =
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker at noaa.gov
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ScaleDemo.py
Type: text/x-python
Size: 2247 bytes
Desc: not available
Url : http://lists.wxwidgets.org/pipermail/wxpython-users/attachments/20070=
412/7dab3b40/ScaleDemo.py
More information about the wxpython-users
mailing list