티스토리 뷰
멀티라인 그래프
plt.plot을 연속적으로 실행하면, 하나의 axes 에 여러 개의 그래프가 그려짐
x = np.linspace(-np.pi, np.pi, 200)
y1, y2 = np.cos(x), np.sin(x)
plt.plot(x, y1, label='코사인 그래프')
plt.plot(x, y2, label='사인 그래프')
plt.legend(loc='upper left')
plt.show()
다중 그래프
하나의 figure 안에 여러 개의 그래프를 나열하여 그릴 수 있음
아래 함수를 사용해서 그리고 싶은 그래프를 axes에 그려줌
plot.subplot(행 개수, 열 개수, 순서)
plt.figure(figsize=(10, 10)) # figure 생성
ax1 = plt.subplot(2, 2, 1) # ax1 은 2x2 에서 첫번째 그래프
plt.plot(x1, y1, 'yo-')
plt.title('첫번째 그래프')
ax2 = plt.subplot(2, 2, 2) # ax2 은 2x2 에서 두번째 그래프
plt.plot(x2, y2, 'r.-')
plt.title('두번째 그래프')
ax3 = plt.subplot(2, 2, 3) # ax3 은 2x2 에서 세번째 그래프
plt.plot(x3, y3, 'b--')
plt.title('세번째 그래프')
ax4 = plt.subplot(2, 2, 4) # ax4 은 2x2 에서 네번째 그래프
plt.plot(x4, y4, 'g.-')
plt.title('네번째 그래프')
plt.show()
'데이터 시각화' 카테고리의 다른 글
[matplotlib 그래프 튜토리얼] 06. 그래프 (pie) (0) | 2023.12.28 |
---|---|
[matplotlib 그래프 튜토리얼] 05. 그래프 (bar) (0) | 2023.12.28 |
[matplotlib 그래프 튜토리얼] 03. plot (figure) (0) | 2023.12.28 |
[matplotlib 그래프 튜토리얼] 02. plot (style.context, with) (1) | 2023.12.28 |
[matplotlib 그래프 튜토리얼] 01.plot (스타일 옵션) (1) | 2023.12.27 |
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- iOS 검은 화면
- django clean
- iOS 화면 안나옴
- 장고 게시판
- django pythoneverywhere
- Django
- 실시간 데이터베이스
- CellForRowAt Not Called
- iOS 데이터베이스
- Firebase 데이터베이스 추천
- django 태그
- django 개발일지
- Realtime Database
- 장고 태그달기
- ModelForm Form 차이
- 웹 배포
- UITableViewController Not Working
- CellForRowAt 호출안됨
- cleaned_data
- django 로그인접근
- 까만 화면
- django 게시판
- pythonanywhere배포방법
- django tag
- pythonanywhere배포
- 알파벳 카운팅
- 테이블출력안됨
- 데이터베이스 추천
- python 웹 배포
- iOS UITableView 출력안됨
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
글 보관함