0
가로 막대 그래프에 주석을 달아야합니다. matplotlib 웹 사이트에 표시된 예제를 사용하여 수직 막대 그래프에 주석을 달 수 있지만 horizonatl에 대한 유사한 아이디어는 효과가없는 것처럼 보입니다. 다음matplotlib의 가로 막대 그래프의 주석
는, 다음은 내가 일하고 싶어 코드입니다 만 평가 수평 그래프
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()
어떤 도움이 작동하지 않습니다에 감사 수직
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()
에 대한 작업 예를 작 전진!