I'm trying to make a polar plot with Python, of which I've been somewhat successful so far
polar scatter plot example
I did have a few questions for which I was hoping to get some ideas/suggestions:
- is it possible set the color of the circles to a specific value (e.g.: "n" in the sample code below)? If so, can I set specific color ranges? E.g: 0-30: red color, 31-40: yellow; 41-60: green
Note: following the examples from Plot with conditional colors based on values in R, I tried ax.scatter(ra,dec,c = ifelse(n < 30,’red','green'), pch = 19 )
without success =(
how can I make the data circles a little bit bigger?
can I move the "90" label so that the graph title does not overlap? I tried:
x.set_rlabel_position(-22.5)
but I get an error ("AttributeError: 'PolarAxes' object has no attribute 'set_rlabel_position'")Is it possible to only show the 0,30, and 60 elevation labels? Can these be oriented horizontally (e.g.: along the 0 azimuth line)?
Thank you so much! Looking forward to hearing your suggestions =)
import numpy
import matplotlib.pyplot as pyplot
dec = [10,20,30,40,50,60,70,80,90,80,70,60,50,40,30,20,10]
ra = [225,225,225,225,225,225,225,225,225,45,45,45,45,45,45,45,45]
n = [20,23,36,43,47,48,49,50,51,50,48,46,44,36,30,24,21]
ra = [x/180.0*3.141593 for x in ra]
fig = pyplot.figure()
ax = fig.add_axes([0.1,0.1,0.8,0.8],polar=True)
ax.set_ylim(0,90)
ax.set_yticks(numpy.arange(0,90,10))
ax.scatter(ra,dec,c ='r')
ax.set_title("Graph Title here", va='bottom')
pyplot.show()