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: polar filled contour without scatter

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:

polar filled contour scatter

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) 

enter image description here

i thought leave question on anyways, still can helpful other users.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

android - Keyboard hides my half of edit-text and button below it even in scroll view -

css - Make div keyboard-scrollable in jQuery Mobile? -