Grabbing individual colors from color maps in matplotlib

Want an individual color from a color map in matplotlib?  You would think this would be easy (and it is as you will see below), but as I traversed the documentation, I could not find for the life of me how to do this.  After looking at various matplotlib functions, Rob and I finally found that it’s really simple (and apparently undocumented as far as we can tell).  Just choose your colormap (e.g. ‘jet’) and call it like a function with a value between 0 and 1: e.g. pylab.cm.jet(.5).  This will return you the rgba 4-tuple that you can use for whatever.

Advertisements

Reclaiming your second monitor in OS X Lion

Upgraded to Lion?  Use dual monitors?  Notice the full screen problem?  My lab mate Rob and I found an interesting hack.

  1. Open an application in full screen mode (e.g. Terminal)
  2. Use three fingers on the trackpad and move slightly to the right or left so you are transitioning into the respective space (the ‘transition position’). Hold this position.
  3. While maintaining the transition position, launch another application.  For example, use spotlight to launch TextEdit by pressing the apple key + space and search for TextEdit. Choose it, and press enter.
  4. Still holding the transition position, wait until your application loads.
  5. Let go of the transition position by lifting your three fingers.

I stumbled across this by accident while trying to open system preferences when in full screen mode as you can see in the attached picture.

Now your second screen is not a paperweight 🙂