2016-12-23 1 views
1

i를 다음 데이터 프레임이 : 나는이 지역의 이름으로 ylabel 위에서 내 dataframe의 (hbar를) 플롯 지금 원하는플롯 사용 dataframe 팬더 (ylabel)

frame1 = pd.DataFrame(res.items(), columns=['Region', 'Ratio']) 

    Region  Ratio 
    0 Midwest  0.005669 
    1 Northeast 0.008920 
    2 North  0.006374 
    3 South  0.002904 
    4 Southeast 0.001928 

그러나, I 만 아래 다음과 같이 Y 라벨에 (0 ~ 4) 수를 얻을 :

frame1['Ratio'].plot(y=frame1['Region'], x=frame1['Ratio'], kind="barh", align='center', color='blue') 

enter image description here

어떻게 각 지역의 이름을 플롯 할 수 있습니다? 인덱스는 yaxis 라벨 될 것

답변

5

사전에 감사합니다, 당신이 시도 할 수 있습니다 :

ax = frame1.set_index('Region').plot(kind="barh", align='center', color='blue') 

enter image description here