반응형
from matplotlib import pyplot as plt
from matplotlib.patches import Rectangle
someX, someY = 0.5, 0.5
plt.figure()
currentAxis = plt.gca()
currentAxis.add_patch(Rectangle((someX - .1, someY - .1), 0.2, 0.2,alpha=1))
plt.show()
다음을 제공합니다.
하지만 내가 원하는 것은 파란색 테두리 만 있고 그 내부가 투명하도록 사각형입니다. 어떻게 할 수 있습니까?
해결 방법
facecolor
를 문자열 'none'(python None
아님)으로 설정하면됩니다.
from matplotlib import pyplot as plt
from matplotlib.patches import Rectangle
someX, someY = 0.5, 0.5
fig,ax = plt.subplots()
currentAxis = plt.gca()
currentAxis.add_patch(Rectangle((someX - 0.1, someY - 0.1), 0.2, 0.2,
alpha=1, facecolor='none'))
참조 페이지 https://stackoverflow.com/questions/21445005
반응형
'파이썬' 카테고리의 다른 글
파이썬 matplotlib에서 datetimes로 x 축 범위를 어떻게 변경합니까? (0) | 2020.12.24 |
---|---|
파이썬 Pandas : 다단계 열 이름 (0) | 2020.12.24 |
파이썬 Matlab의 'hold on'에 해당하는 Python (0) | 2020.12.24 |
파이썬 Python 객체가 "구독 가능"여부는 무엇을 의미합니까? (0) | 2020.12.24 |
파이썬 ElementTree 노드 부모 노드에 액세스 (0) | 2020.12.23 |
댓글