본문 바로가기

시각화

(42)
Matplotlib - plot 차이 : 시리즈.plot vs plt.plot(시리즈) https://steadiness-193.tistory.com/149 Matplotlib - plt : 선그래프, xlabel, ylabel, title, legend(범례) 데이터 불러오기 서울에서 경기도로 이동한 인구 데이터 값 import matplotlib.pyplot as plt 한글 폰트 문제 해결 from matplotlib import font_manager, rc font_path = 'c:/Windows/Fonts/malgun.ttf' font_na.. steadiness-193.tistory.com 위 포스팅에서 선그래프를 그릴 때 3가지 방법으로 실행하는 것을 살펴봤다. 지금은 좀 더 자세히 어떻게 다르게 이용할 수 있을지 알아보자 시리즈 제작 위와 같은 시리즈를 선그래프로 그려보자..
Matplotlib - 하나의 axe 객체에 여러 개 그래프 그리기 [1개의 컬럼 이용] (예시 : 히스토그램) 1. add_subplot add_subplot을 이용해 ax 틀을 생성한다. 이제 ax에 바로 그래프 종류를 기입해서 그려내면 된다. ax.hist 박스로 체크한 부분에 보이듯이 plt.xlabel을 이용하든 ax.set_ylabel을 이용하든 괜찮다. 2. subplots 2-1. ax = df['컬럼'].hist 파라미터에 ax=ax[0]을 입력하면 에러가 발생한다. 이 경우 또한 plt.xlabel이든 ax.set_ylabel이든 괜찮다. 2-2. ax = df['컬럼'].plot.hist 2-1 방법과는 격자가 없는 것 말곤 다를 것이 없다. 안되는 경우 2-3. ax = df.hist(column='컬럼명') 이 경우는 생성한 15, 5 틀에 그려지..
Matplotlib - 그래프를 파일로 저장하기 : savefig plt.savefig(fname, dpi, facecolor, format, bbox_inches, transparent) - fname : 파일 경로나 파이썬의 유사한 객체를 나타내는 문자열 (파일명.pdf) - dpi : figure의 인치당 도트 해상도, 기본값은 100 - facecolor : edgecolor로도 설정가능하며 배경 색상을 변경함, 기본값은 흰색 - format : 명시적 파일 포맷 (png, svg, pdf...) - bbox_inches : figure에서 저장할 부분 - transparent : 그림 배경을 투명하게 지정 (True를 넘기면 된다.) 아무 옵션 없이 그냥 저장 옵션 추가 : dpi=400, bbox_inches='tight' 이는 사진의 크기를 키운 것이 아니..
Matplotlib - add_subplot : set_xticks, set_xticklabels, tick_params https://steadiness-193.tistory.com/162 Matplotlib - add_subplot 화면 분할하여 그래프를 여러 개 그리기 - axe 객체 활용 이 포스팅에선 우선 하나의 그래프를 ax 객체를 이용해서 그려본다. https://steadiness-193.tistory.com/149 Matplotlib - plt : 선그래프, xlabel, ylab.. steadiness-193.tistory.com 위 포스팅에서 설명을 했지만 추가적으로 x축에 대해서만 더 살펴보자. 기본 그래프 data = np.random.randn(100).cumsum() set_xticks : 전체 데이터 범위에 맞춰 눈금을 어디에 배치할지 지정 지금은 0부터 20씩 커진 100까지의 눈금이 있지만 ..
Matplotlib - add_subplot(2) https://steadiness-193.tistory.com/149 Matplotlib - plt : 선그래프, xlabel, ylabel, title, legend(범례) 데이터 불러오기 서울에서 경기도로 이동한 인구 데이터 값 import matplotlib.pyplot as plt 한글 폰트 문제 해결 from matplotlib import font_manager, rc font_path = 'c:/Windows/Fonts/malgun.ttf' font_na.. steadiness-193.tistory.com 위 포스팅에서 만든 sr_kk 시리즈를 이용한다. https://steadiness-193.tistory.com/162 Matplotlib - add_subplot 화면 분할하여 그래프를 ..
Matplotlib - add_subplot 화면 분할하여 그래프를 여러 개 그리기 - axe 객체 활용 이 포스팅에선 우선 하나의 그래프를 ax 객체를 이용해서 그려본다. https://steadiness-193.tistory.com/149 Matplotlib - plt : 선그래프, xlabel, ylabel, title, legend(범례) 데이터 불러오기 서울에서 경기도로 이동한 인구 데이터 값 import matplotlib.pyplot as plt 한글 폰트 문제 해결 from matplotlib import font_manager, rc font_path = 'c:/Windows/Fonts/malgun.ttf' font_na.. steadiness-193.tistory.com 위 포스팅에서 만든 sr_kk 시리즈를 이용한다. 주피터 노..
Matplotlib - plt : xlim, ylim https://steadiness-193.tistory.com/151 Matplotlib - 그래프 꾸미기 : marker, markerfacecolor, markersize, color, linewidth, linestyle https://steadiness-193.tistory.com/150 Matplotlib - plt : xticks, yticks https://steadiness-193.tistory.com/149 Matplotlib - 선그래프, x축 라벨, y축 라벨, 그래프 제목, 범례 데이터 불러오기 서울에서.. steadiness-193.tistory.com 위 포스팅에서 만든 그래프를 이용한다. 기존 그래프 xlim x축의 최솟값과 최댓값을 설정한다. plt.xlim([최솟값, 최댓값..
Matplotlib - 그래프 꾸미기 : marker, markerfacecolor, markersize, color, linewidth, linestyle https://steadiness-193.tistory.com/150 Matplotlib - plt : xticks, yticks https://steadiness-193.tistory.com/149 Matplotlib - 선그래프, x축 라벨, y축 라벨, 그래프 제목, 범례 데이터 불러오기 서울에서 경기도로 이동한 인구 데이터 값 import matplotlib.pyplot as plt 한글 폰트.. steadiness-193.tistory.com 위 포스팅에서 만든 그래프를 이용한다. 선 그래프의 꾸미기 옵션 옵션 설명 'o' 선이 아닌 점 그래프 marker 마커 모양 'o' ',' '^' '' '*' '+' 'v' '8' 's' 'p' 'h' 'D' '.' markerfacecolor 마커 배경..