2012-11-28 3 views
6

극단적 인 그림이 빨간색으로 완전히 채색되어있는 특정 부분이 있습니다 (두 개의 빨간색 선 사이에 표시된 부분입니다). 패치 모음을 사용하여 고체 링 부문을 얻기 위해 그 해당 섹션 색상 것 아니면이 가능합니다 여기에 enter image description here파이썬 : 반지 부분 또는 웨지를 극좌표에 추가하십시오.

내 스크립트입니다?

from pylab import * 
import matplotlib.pyplot as plt 
import numpy as np 
import pylab 
from matplotlib.projections import PolarAxes 



############################################################################### 
############################################################################### 


fig = figure() 
ax = fig.add_subplot(111, projection = 'polar') 


subplot(111,projection='polar') 
theta = arange(1000)*2*pi/1000. 

plot(theta,0.25*ones(1000),'m') #A to B Circle 
plot(theta, 0.65*ones(1000), 'm') # B to C Circle 
plot([0, 0],[0.25,0.65],'m') # A to B 0 degrees line 
plot([pi/4.,pi/4.],[0.25, 0.65], 'm') # A to B 45 degrees line 
plot([pi/2, pi/2.],[0.25, 0.65], 'm') # A to B 90 degrees line 
plot([3*pi/4.,3*pi/4],[0.25, 0.65], 'm') # A to B 135 degrees line 

plot([pi,pi],[0.25,0.65],'m') # A to B 180 degrees line 
plot([5*pi/4,5*pi/4],[0.25, 0.65], 'm') # A to B 225 degrees line 
plot([3*pi/2,3*pi/2],[0.25, 0.65], 'm') # A to B 270 degrees line 
plot([7*pi/4,7*pi/4],[0.25, 0.65], 'm') # A to B 315 degrees line 

plot([2*pi,2*pi],[0.25,0.65],'m') # A to B 360 degrees line 

plot([0, 0],[0.65,1],'m') # B to C 0 degrees line 
plot([pi/6,pi/6],[0.65, 1], 'm') # B to C 30 degrees line 
plot([pi/3,pi/3.],[0.65,1], 'm') # B to C 60 degrees line 
plot([pi/2,pi/2],[0.65,1], 'm') # B to C 90 degrees line 

plot([2*pi/3,2*pi/3],[0.65,1],'m') # B to C 120 degrees line 
plot([5*pi/6,5*pi/6],[0.65,1], 'm') # B to C 150 degrees line 
plot([pi,pi],[0.65,1], 'm') # B to C 180 degrees line 
plot([7*pi/6,7*pi/6],[0.65,1], 'm') # B to C 210 degrees line 

plot([4*pi/3,4*pi/3],[0.65,1],'r', linewidth = 5) # B to C 240 degrees line 
plot([3*pi/2,3*pi/2],[0.65,1], 'r', linewidth = 5) # B to C 270 degrees line 
plot([5*pi/3,5*pi/3],[0.65, 1], 'm') # B to C 300 degrees line 
plot([11*pi/6,11*pi/6],[0.65,1], 'm') # B to C 330 degrees line 

plot([2*pi,2*pi],[0.65,1],'m') # B to C 360 degrees line 




#patches = [Wedge((0,0), 1, 4*pi/3, 3*pi/2)] 
#p = PatchCollection(patches) 
#ax.add_collection(p) 

rgrids((1,1),('','')) 


ax.set_theta_zero_location("N") 
ax.set_theta_direction('clockwise')   

show() 

답변

1

쐐기의 방법이 될 것 같다 이동하지만 기본적으로 북극 협곡으로 변환됩니다. ates. 쐐기에 축 변환을 부여 할 수 있습니다. 시각적으로 작동하지만 데이터를 기반으로 쐐기를 그려야하는 경우 어렵게 만듭니다.

ax.add_artist(Wedge((.5,.5), 0.53, 180, 215, width=0.2, transform=ax.transAxes, color='red')) 

enter image description here

:

그것은처럼 할 수있다