|
| 1 | +#!/usr/bin/env python |
| 2 | +# |
| 3 | +# matplotlib now has a PolarAxes class and a polar function in the |
| 4 | +# matplotlib interface. This is considered alpha and the interface |
| 5 | +# may change as we work out how polar axes should best be integrated |
| 6 | +# |
| 7 | +# The only function that has been tested on polar axes is "plot" (the |
| 8 | +# matlab interface function "polar" calls ax.plot where ax is a |
| 9 | +# PolarAxes) -- other axes plotting functions may work on PolarAxes |
| 10 | +# but haven't been tested and may need tweaking. |
| 11 | +# |
| 12 | +# you can get get a PolarSubplot instance by doing, for example |
| 13 | +# |
| 14 | +# subplot(211, polar=True) |
| 15 | +# |
| 16 | +# or a PolarAxes instance by doing |
| 17 | +# axes([left, bottom, width, height], polar=True) |
| 18 | +# |
| 19 | +# The view limits (eg xlim and ylim) apply to the lower left and upper |
| 20 | +# right of the rectangular box that surrounds to polar axes. Eg if |
| 21 | +# you have |
| 22 | +# |
| 23 | +# r = arange(0,1,0.01) |
| 24 | +# theta = 2*pi*r |
| 25 | +# |
| 26 | +# the lower left corner is 5/4pi, sqrt(2) and the |
| 27 | +# upper right corner is 1/4pi, sqrt(2) |
| 28 | +# |
| 29 | +# you could change the radial bounding box (zoom out) by setting the |
| 30 | +# ylim (radial coordinate is the second argument to the plot command, |
| 31 | +# as in matlab, though this is not advised currently because it is not |
| 32 | +# clear to me how the axes should behave in the change of view limits. |
| 33 | +# Please advise me if you have opinions. Likewise, the pan/zoom |
| 34 | +# controls probably do not do what you think they do and are better |
| 35 | +# left alone on polar axes. Perhaps I will disable them for polar |
| 36 | +# axes unless we come up with a meaningful, useful and functional |
| 37 | +# implementation for them. |
| 38 | + |
| 39 | +from matplotlib.matlab import * |
| 40 | + |
| 41 | +r = arange(0,4,0.001) |
| 42 | +theta = 6*pi*r |
| 43 | +polar(theta, r) |
| 44 | +title("It's about time!") |
| 45 | +savefig('polar_demo') |
| 46 | +show() |
0 commit comments