python - Overlapping polar countourf and scatter plot -
thanks helpful post, figured out how make polar filled-contour plot. however, when moved next step , tried add scatter point same plot, ran in problems. here original script:
import numpy np import matplotlib.pyplot plt #-- generate data ----------------------------------------- # using linspace endpoint of 360 included... azimuths = np.radians(np.linspace(0, 360, 20)) zeniths = np.arange(0, 70, 10) r, theta = np.meshgrid(zeniths, azimuths) values = np.random.random((azimuths.size, zeniths.size)) #-- plot... ------------------------------------------------ fig, ax = plt.subplots(subplot_kw=dict(projection='polar')) ax.contourf(theta, r, values) plt.show() which produced image: 
if add scatter plot:
#-- plot... ------------------------------------------------ fig, ax = plt.subplots(subplot_kw=dict(projection='polar')) ax.contourf(theta, r, values) ax.scatter(np.radians(140), 40, s=20, c='white') i instead image:

why thick white border between filled contours , axes? how rid of it?
thank much!
ops, sorry answer occurred me 2 minutes after asked question. realized adding scatter plot somehow changes axes limits. forcing axes desired interval fixes problem.
fig, ax = plt.subplots(subplot_kw=dict(projection='polar')) ax.contourf(theta, r, values) ax.scatter([np.radians(140)], [40], s=20, c='white') ax.set_rmax(60) ax.set_rmin(0) 
i thought leave question on anyways, still can helpful other users.
Comments
Post a Comment