스타일 옵션 문자열
스타일 문자열 | 약자 | 의미 |
color | c | 선 색깔 |
linewidth | lw | 선 굵기 |
linestyle | ls | 선 스타일 |
marker | 마커 종류 | |
markersize | ms | 마커 크기 |
markeredgecoloc | mec | 마커테두리 색깔 |
markeredgewidth | mew | 마커테두리 굵기 |
markerfacecolor | mfc | 마커 내부 색깔 |
마커 모양 지정 문자열 plt.plot(data, '.') 또는 plt.plot(data, marker='.')
마커 문자열 | 의미 | 마커문자열 | 의미 |
. | point | , | pixel |
o | circle | v | triangle down |
^ | triangle up | < | triangle left |
> | triangle right | 1 | tri_down |
2 | tri_up | 3 | tri_left |
4 | tri_right | s | square |
p | pentagon | * | star |
h | hexagon1 | H | hexagon2 |
+ | plus | x | x |
D | diamond | d | thin diamond |
색깔 문자열
색깔 문자열 | 약자 |
blue | b |
green | g |
red | r |
cyan | c |
magenta | m |
yellow | y |
black | k |
white | w |
선 스타일 문자열
선 스타일 문자열 | 의미 |
- | solid line |
-- | dashed line |
-. | dash-dot line |
: | dotted line |
스타일 적용 예
plt.plot([1, 4, 9, 16], c="b", lw=5, ls="--", marker="o", ms=15, mec="g", mew=5, mfc="r")
plt.plot(*args, scalex=True, scaley=True, data=None, **kwargs)
plot([x], y, [fmt], , data=None, *kwargs)
plot([x], y, [fmt], [x2], y2, [fmt2], ..., **kwargs)
fmt = '[marker][line][color]' # 순서상관없음.( -. 주의 )
plot(x, y) # plot x and y using default line style and color
plot(x, y, 'bo') # plot x and y using blue('b') circle markers('o')
plot(y) # plot y using x as index array 0..N-1
plot(y, 'r+') # ditto, but with red plusses
예제
a = np.arange(0, 2, 0.2)
plt.plot(a, a, 'r--',
a, a**2, 'bo',
a, a**3, 'g-.')
plt.legend(["a", "a**2", "a**3"]) # 범례 그리기
plt.show()
맷플롯립 차트 스타일(matplotlib chart sheets) 관련 최신 정보는 여기
GitHub - matplotlib/cheatsheets: Official Matplotlib cheat sheets
Official Matplotlib cheat sheets. Contribute to matplotlib/cheatsheets development by creating an account on GitHub.
github.com
'Python 파이썬 > matplotlib' 카테고리의 다른 글
matplotlib ) 하나의 figure에 여러 개의 그래프 그리기 (0) | 2022.03.25 |
---|---|
matplotlib ) Figure, Axes 설정 (0) | 2022.03.25 |
matplotlib ) 맷플롯립 개요 & 한글 폰트 오류 해결 (0) | 2022.03.21 |
댓글