홈>
가로 막대 그래프에 주석을 달아야 합니다. matplotlib 웹 사이트에 표시된 예제를 사용하여 수직 막대 그래프에 주석을 달 수 있지만 수평에 대한 유사한 아이디어가 작동하지 않는 것 같습니다.
다음은 수직에 대한 작은 작업 예입니다.
from pylab import *
ops= 90*rand(4) # the bar lengths
pos= arange(4)+.5 # the bar centers on the y axis
rects1= bar(pos, ops)
def autolabel(rects):
for rect in rects:
height= rect.get_height()
plt.text(rect.get_x() + rect.get_width()/2., 1.05*height,
'%d' % int(height),
ha='center', va='bottom')
autolabel(rects1)
show()
다음은 작업하고 싶지만 가로 그래프에서는 작동하지 않는 code입니다.
from pylab import *
ops= 90*rand(4) # the bar lengths
pos= arange(4)+.5
rects1= barh(pos, ops)
def autolabel(rects):
for rect in rects:
width= rect.get_width()
plt.text(rect.get_y() -1.05*rect.get_height()/2., 1.00*width,
'%d' % int(width),
ha='center', va='bottom')
autolabel(rects1)
show()
도움을 주시면 감사하겠습니다. 미리 감사드립니다!
관련 자료
- python - matplotlib의 한 플롯에 팬더 데이터 프레임의 여러 막대 그래프를 어떻게 추가합니까?
- matplotlib에서 그래프를 만들기 위해 파이썬을 자동화하는 방법
- python - Matplotlib은 마커 스타일 그래프로만 작동합니다 어떻게 해결합니까?
- python - Matplotlib를 사용하여 그래프 조정
- 수평 matplotlib 히스토그램에 x 축 값 표시
- python - matplotlib을 사용하여 가로 백분율 막대 그림을 그리는 방법은 무엇입니까?
- python - Google에서 생성 한 matplotlib 그래프와 다릅니다
- python - Matplotlib에서 두 데이터 포인트 사이에 수평선을 그리는 방법은 무엇입니까?
- python - matplotlib 그래프를위한 공간 만들기
- javascript - Google 차트를 사용하여 가로 막대의 세로줄 주석
- Google 차트 막대 가로 이동 주석 위치를 누적 차트 중심으로
- python - Matplotlib에서 3 개의 그래프 사이에 공간 채우기
- python - 점 matplotlib 위에 주석 추가
- python 3.x - matplotlib에서 그래프 축소?
- python - 플롯으로 표현 된 그래프와 같은 Matplotlib
- python - matplotlib의 가로 누적 막대 그래프 문제
- python - tikz 스타일 경로 장식이있는 Matplotlib 주석 화살표
- python - 하나의 데이터 프레임에서 matplotlib에 여러 그래프를 만들기 위해 반복합니까?
- python - Matplotlib 파이/도넛 차트 주석 텍스트 크기
- python - 수평선 그리기 (matplotlib)
관련 질문
- python : TypeError: matplotlib에서 플롯의 정수 스칼라 배열만 스칼라 인덱스로 변환할 수 있습니다.
- 사전(python, dict, 여러 플롯)에서 여러 dfs를 사용하여 루프에서 특정 수의 플롯을 플롯합니다.
- python : 텍스트를 기울임꼴로 만든 후 Figsize 및 축 선 너비가 갑자기 작아짐
- "ValueError: Shape Mismatch"로 이어지는 Python 오류 캐스케이드
- python : pandas DataFrame 플롯 xticks 간격이 작동하지 않습니다.
- python : matplotlib의 vlines에서 한 줄의 색상을 변경할 수 있습니까?
- python : Matplotlib pyplot stackplot은 앤티앨리어싱 시 아티팩트를 생성합니다.
- python : matplotlib를 사용하는 파이썬에서 matplotlib.pyplot.xlabel()과 .set_xlabel()의 차이점은 무엇입니까?
- python : matplotlib를 사용하여 3D Numpy 배열을 플로팅하는 분산형
- matplotlib(Python)에서 초 대신 HH:MM:SS에서 y축 만들기