Setting up a Python working envrionment on Windows

The following is a quick walkthrough on how to setup a Python working environment on a Windows machine.

This working environment is especially useful if you are a scientist, or working on a 64-bit Windows, because the python distribution mentioned below contains many important packages for scientists and for everyone precompiled for 64-bit python. Also, in this walktrhough you will setup and config IPython, which is great. And of course I already RTFMed (almost) everything for you.

  1. Install the Enthought Python Distribution (EPD), which is a Python 2.7 bundled with many python scientific packages such as Numpy, Scipy, IPython, etc. Academics get a free license.
  2. Setup IPython:
    1. Add these arguments to the shortcut running the IPython QT console:
      --pylab=inline --editor="c:\python27\lib\idlelib\idle.pyw -e"
    2. Add imports you like to C:\Users\<USERNAME>\.ipython\profile_default\startup
  3. Change the IDLE configuration file C:\Users\<USERNAME>\.idlerc\config-main.cfg 
    default = 0
    name = up-down
    autosave = 1
    editor-on-startup = 1
  4. If you don’t want a to install a revision control system, you’re done. If you do, go on.
  5. Install Mercurial by downloading and installing ToirtoiseHg.
  6. Setup TortoiseHg – in C:\Users\<USERNAME>\mercurial.ini:

# Generated by TortoiseHg settings dialog
 username = Full Name

 push_ssl = True

 fetch =


Set up VLC HTTP interface to allow connections on the LAN

RTFM from one of the following:


Controling VLC from the browser then looks like this:

VLC controled from the browser via HTTP interface

VLC controled from the browser via HTTP interface

Now you can choose your Android remote control app from the following list.

Enjoy pausing your lame sitcoms from your smartphone.

Adding a scale label to an axis in Mathematica

This is a trick that eluded me for a few days but finally I managed to RTFM it.

There’s no built-in option for this but it is easy to do once you know how.

Normally you would do this with AxesLabel->{"xlabel","ylabel"}.

But what do you do when you use a frame (Frame->True)? Which is what you would do when you prepare a good looking figure…

FrameLabel->{"xlabel","ylabel","x2label","y2label"} appear in the middle of the axes, as they should as they tell you what the axes are about.

But if you also want an axis scale, like 10^4 or 10^-5 then you need to use the following (for a y-axis label):

Epilog->Inset["10^3", ImageScaled[{0.03,0.97}]],

The important commands are in red.

FrameTicks allows you to choose which ticks are labeled but also HOW they are labeled – 2 instead of 2000, etc.

Epilog allows you to add some graphics to the plot.

Inset is… well here it allows you to add some text.

ImageScaled is a clever way to position the text. Usually you just give a couple of coordinates based on the plot axes (like 0,0 for something that will appear on the origin). But with ImageScaled you can position something on the whole image, and not just inside the plot area.

PlotRangeClipping is an important option to use, because it allows things outside of the plot area to be displayed instead of clipped.

Here’s the result:

The figure created by the code above

Fig. 1 – The exponential function

All the options and functions used (marked as code) can be easily RTFMed in Mathematica’s online documentation.

I’ve used Mathematica 8 so I’m not sure how these things respond to older versions.

See Also: