|
From: Paul I. <piv...@gm...> - 2011-01-17 02:23:56
|
Uri Laserson, on 2011-01-16 17:41, wrote: > Hi all, > > Does there already exist some python implementation (in MPL or other) of an > easy-to-use 1D scale transformation? This is something analogous to > processing's map function or protovis's scale functionality. It would work > something like: > > s = linear().domain(5,100).range(13000,15000) > > or > > s = root(p=5).domain(0.1,0.6).range(0,1) > > There could be multiple versions, including linear, log, symlog, root > (power), discrete, etc. Hi Uri, I think that the closest we have matplotlib is matplotlib.colors.Normalize[1] and matplotlib.colors.LogNorm[2], but both of these have a fixed range of the 0-1 (which is the reason they are in colors). Both of these do end up with an inverse method that you could leverage to get an arbitrary range, though. 1. http://matplotlib.sourceforge.net/api/colors_api.html#matplotlib.colors.Normalize 2. http://matplotlib.sourceforge.net/api/colors_api.html#matplotlib.colors.LogNorm -- Paul Ivanov 314 address only used for lists, off-list direct email at: http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7 |