Analog of processing map() or protovis scale?

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.

Thanks!

Uri

Uri Laserson
Graduate Student, Biomedical Engineering

Harvard-MIT Division of Health Sciences and Technology
M +1 917 742 8019
laserson@…2705…66…

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

For convenience of use, I implemented three simple scales. I have not yet tested it rigorously, but the usage is similar to protovis scales.

https://github.com/laserson/pytools/blob/master/scale.py

Uri

Uri Laserson
Graduate Student, Biomedical Engineering
Harvard-MIT Division of Health Sciences and Technology

M +1 917 742 8019
laserson@…1166…

···

On Sun, Jan 16, 2011 at 21:23, Paul Ivanov <pivanov314@…287…> wrote:

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

-----BEGIN PGP SIGNATURE-----

Version: GnuPG v1.4.10 (GNU/Linux)

iEYEARECAAYFAk0zqBAACgkQe+cmRQ8+KPcfSwCdGJp3J4uENsx11VMKAJdxkLEG

SEMAn1qqBYY8G6M1bcsfl7+7yc3doKiw

=x2vj

-----END PGP SIGNATURE-----


Protect Your Site and Customers from Malware Attacks

Learn about various malware tactics and how to avoid them. Understand

malware threats, the impact they can have on your business, and how you

can protect your company and customers by using code signing.

http://p.sf.net/sfu/oracle-sfdevnl


Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-users