polar plots, clockwise, north

Tim Roberts timr at probo.com
Fri Apr 17 08:16:52 CEST 2009

enricong at gmail.com wrote:
>I've been trying to figure out how to do this for a while with
>matplotlib.  I need to make polar plots which go around clockwise and
>have 0deg on top (north) instead of on the side (east).  How can this
>be done?

Is it really that hard?

    def compass( theta, r, **kwargs ):
        matplotlib.pyplot.polar( math.pi/2 - theta, r, **kwargs )

or, to handle lists of points:

    def compass( theta, r, **kwargs ):
        d90 = math.pi/2
        if type(theta) == list:
            rotate = [d90 - k for k in theta]
            return matplotlib.pyplot.polar( rotate, r, **kwargs )
            return matplotlib.pyplot.polar( d90 - theta, r, **kwargs )
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.

More information about the Python-list mailing list