|
From: Friedrich R. <fri...@gm...> - 2010-10-20 15:40:45
|
2010/10/20 Stefan Mauerberger <ste...@mn...>: > I want to make a polar plot with grid not of the full circle but a > section (e.g. r=[5:6], phi=[-20:30]). The result should look like this: > http://homepages.physik.uni-muenchen.de/~Stefan.Mauerberger/example.png > I have tried a lot and had also looked to the examples but my results > are not satisfying. This example > http://matplotlib.sourceforge.net/examples/axes_grid/demo_curvelinear_grid.html seems to be highly relevant for my needs but i do not understand it at all. > > I tried two different ways: > Using the option polar=True works fine but I was not able to shrink the > plot to the section. > Otherwise transforming the data to cartesian coordinates (e.g. > pcolor(r*np.sin(phi),r*np.cos(phi),data) ) the data are plotted into a > box. But in this case I do not know how to draw a grid. I believe only option (2) will be feasible, I remember a discussion in past about this to having had the same outcome. Try here: http://matplotlib.sourceforge.net/api/axes_api.html#matplotlib.axes.Axes.pcolor (*faceted* option). Notice the next functions on that page, they might help you saving time, but some of them *might* not work in polar Axes, I'm not sure which of them if any at all, just be warned. Make sure you're using 1:1 aspect of the axes containing the pcolor() Collection, or it will look distorted. Friedrich P.S.: If this is your first mpl-users thread, make sure to hit the reply-to-all button ... |