검색결과 리스트
글
[Python] Matplotlib을 이용한 histogram 그리기
코딩/Python
2014. 8. 4. 11:07
[Matplotlib 설치]
1. Numpy 설치
- 설치된 Python 버전에 맞는 numpy 설치
2. Matplotlib 설치
- 구글링해서 1.3.1 버전을 받아서 설치했더니 'matplotlib requires dateutil'이라는 에러 발생
- 그냥 아래 링크 설명대로 github에서 다시 받아서 설치했더니 문제 없었음
(http://matplotlib.org/users/installing.html)
[Histogram 그리기]
1. 예제 코드
- TP_list와 FP_list에 들어있는 값들에 대한 histogram을 겹쳐서 그림
- 'alpha=0.5'를 통해 투명도 조절
import matplotlib.pyplot as plt ... plt.hist(TP_list, bins=100, color='b', label='TP') plt.hist(FP_list, bins=100, color='r', alpha=0.5, label='FP') plt.title('Score Histogram') plt.xlabel('Scores') plt.ylabel('Frequency') plt.legend() plt.show()
2. 그 외
- 자세한 설명은 생략한다 아래 링크 참조
(http://bespokeblog.wordpress.com/2011/07/11/basic-data-plotting-with-matplotlib-part-3-histograms/)
'코딩 > Python' 카테고리의 다른 글
[Python] 파일 라인 수정 (0) | 2014.04.28 |
---|