728x90
๋ฐ˜์‘ํ˜•

ํŒŒ์ด์ฌ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ Matplotlib๋กœ ๋ฐ์ดํ„ฐ ์‹œ๊ฐํ™” ํ•  ๋•Œ๋งˆ๋‹ค ํ•œ๊ธ€๋“ค์ด ๊นจ์ง€๋Š” ํ˜„์ƒ๋“ค์„ ๋งŽ์ด ๋ณผ๊ฑฐ๋‹ค.

๋ฌผ๋ก  ์˜์–ด๋กœ ์ž‘์„ฑํ•˜๋ฉด ์ด๋Ÿฌํ•œ ์˜ค๋ฅ˜๋Š” ๋‚˜ํƒ€๋‚˜์ง€ ์•Š์„๊ฑฐ์ง€๋งŒ.....

์—ฌํŠผ ์˜ค๋Š˜์€ ํ•œ๊ธ€๊นจ์ง ํ•ด๊ฒฐ ๋ฐฉ๋ฒ•์„ ์˜ฌ๋ฆฌ๊ณ ์ž ํ•œ๋‹ค.

 

๊ฐœ๋ฐœํ™˜๊ฒฝ - Jupyter Notebook

 

Matplotlib ํ•œ๊ธ€ ํฐํŠธ ์ •๋ณด ์กฐํšŒ

1. Matplotlib์˜ font_manager์— ํ˜„์žฌ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋Š” ์ „์ฒด ํฐํŠธ์™€ ๊ฒฝ๋กœ๋ฅผ ํ•˜๋‚˜ ํ•˜๋‚˜์”ฉ ์ฐพ๋Š” ๋ฐฉ๋ฒ•

import matplotlib.font_manager as fm
font_list = fm.findSystemFonts(fontpaths=None, fontext='ttf')
font_list[:]

 

2. ์•Œ๊ณ  ์žˆ๋Š” ํฐํŠธ๋ฅผ ์ž…๋ ฅํ•ด์„œ ํฐํŠธ์˜ ์—ฌ๋ถ€๋ฅผ ํ™•์ธ ํ•  ์ˆ˜ ์žˆ๋Š” ๋ฐฉ๋ฒ•

import matplotlib.font_manager as fm

font_name = 'Nanum'
[(f.name, f.name) for f in fm.fontManager.ttflist if f'{font_name}' in f.name]

 

2๊ฐ€์ง€ ๋ฐฉ๋ฒ• ์ค‘ ์•„๋ฌด ๋ฐฉ๋ฒ•์ด๋‚˜ ์‚ฌ์šฉํ•ด์„œ ํฐํŠธ ์—ฌ๋ถ€๋ฅผ ํ™•์ธํ•ด์ฃผ๋ฉฐ ๋ฉ๋‹ˆ๋‹ค.

 

Matplotlib ํ•œ๊ธ€ ์ ์šฉ

ํ•œ๊ธ€ ์ ์šฉ์€ importํ•ด์„œ ๋ถˆ๋Ÿฌ์™€์ฃผ๊ธฐ๋งŒ ํ•˜๋ฉด๋œ๋‹ค. ๊ทธ๋ฆฌ๊ณ  ํ•œ๊ธ€ ํฐํŠธ๋ฅผ ์‚ฌ์šฉํ•˜๊ฒŒ๋˜๋ฉด ๋งˆ์ด๋„ˆ์Šค ( - )๊ฐ€ ๊นจ์ง ํ˜„์ƒ๋„ ์ผ์–ด๋‚˜๋Š”๋ฐ ๊ทธ ๋งˆ์ด๋„ˆ์Šค์— ๊ด€ํ•œ ๋‚ด์šฉ๋„ ๋ฐ‘์— ์ ์–ด ๋‘์—ˆ๋‹ค.

import matplotlib.pyplot as plt

# family์—๋‹ค๊ฐ€ ์ž๊ธฐ๊ฐ€ ์“ธ ํฐํŠธ ์ด๋ฆ„์„ ์ ์–ด์ค€๋‹ค.
# ํฐํŠธ ์„ค์ •
plt.rc('font', family='NanumGothicCoding')
# ๋งˆ์ด๋„ˆ์Šค ๊นจ์ง ํ˜„์ƒ
plt.rc('axes', unicode_minus=False)

 

728x90
๋ฐ˜์‘ํ˜•
728x90
๋ฐ˜์‘ํ˜•

DB๋‚˜ CSV ๋“ฑ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ์–‘์ด ๋งŽ์€ ์ƒํƒœ์—์„œ Jupyter์— ์ถœ๋ ฅ์„ ํ•˜๊ฒŒ๋œ๋‹ค๋ฉด

 

IOPub data rate exceeded.
The notebook server will temporarily stop sending output
to the client in order to avoid crashing it.
To change this limit, set the config variable
`--NotebookApp.iopub_data_rate_limit`.

Current values:
NotebookApp.iopub_data_rate_limit=1000000.0 (bytes/sec)
NotebookApp.rate_limit_window=3.0 (secs)

 

์ด๋Ÿฌํ•œ ์˜ค๋ฅ˜๋ฅผ ๋ฐœ์ƒํ•  ๊ฒƒ์ด๋‹ค. ์ด ์˜ค๋ฅ˜๋ฅผ ํ•ด๊ฒฐํ•˜๋Š” ๋ฐฉ๋ฒ•์€ ์•„๋ž˜์ฒ˜๋Ÿผ ํ•˜๋ฉด ๋ฉ๋‹ˆ๋‹ค.

 

1.  Jupyter ๋‚ด๋ถ€ ํ„ฐ๋ฏธ๋„ ์‚ฌ์šฉ

 โ˜ž Jupyter ๋‚ด๋ถ€์— ์žˆ๋Š” ํ„ฐ๋ฏธ๋„์„ ์‚ฌ์šฉํ•˜์—ฌ ์•„๋ž˜์˜ ๋ช…๋ น์–ด๋ฅผ ์‚ฌ์šฉํ•จ.

jupyter notebook --NotebookApp.iopub_data_rate_limit=1.0e10

 โ˜ž Jupyter ์ƒˆ๋กœ ์ผœ์ง€๊ฒŒ ๋˜๊ณ  ์‹คํ–‰ ์‹œํ‚ค๋ฉด ์˜ค๋ฅ˜๊ฐ€ ํ•ด๊ฒฐ๋˜๋Š” ๊ฒƒ์„ ๋ณผ ์ˆ˜ ์žˆ์Œ.

 

2.  ํ™˜๊ฒฝ์„ค์ • ๋ณ€๊ฒฝ

โ˜ž ๋ฆฌ๋ˆ…์Šค, cmd, ํŒŒ์›Œ์…€ ๋“ฑ ๋ช…๋ น์–ด ์ ๋Š” ๊ณณ์—๋‹ค ์•„๋ž˜ ๋ช…๋ น์–ด ์‚ฌ์šฉ

jupyter notebook --generate-config

โ˜ž Jupyter ํ™˜๊ฒฝ์„ค์ • ํŒŒ์ผ์ด ์žˆ๋Š” ๊ฒฝ๋กœ๊ฐ€ ๋‚˜์˜ด

โ˜ž ๊ทธ ๊ฒฝ๋กœ์— ๊ฐ€์„œ ๋ฉ”๋ชจ์žฅ์ด๋‚˜ vi, vim ๋“ฑ ํŽธ์ง‘์—๋””ํ„ฐ๋ฅผ ์ด์šฉํ•ด " jupyter_notebook_config.py " ํŒŒ์ผ์„ ์—ผ

โ˜ž ํ™˜๊ฒฝ์„ค์ •์— ๊ด€ํ•œ ๋‚ด์šฉ๋“ค์ด ์žˆ๋Š”๋ฐ ์—ฌ๊ธฐ์„œ " c.NotebookApp.iopub_data_rate_limit  " ๋ฌธ์žฅ์„ ์ฐพ์Œ

โ˜ž #c.NotebookApp.iopub_data_rate_limit = 1000000 #(์ฃผ์„)๊ณผ 1000000์„ ์ง€์šฐ๊ณ  1000000 ์ž๋ฆฌ์— 1.0e10 ๋ฅผ ์ž‘์„ฑํ•˜๊ณ  ์ €์žฅํ•จ

 โ˜ž Jupyter ์ƒˆ๋กœ ํ‚ค๋ฉด ์˜ค๋ฅ˜๊ฐ€ ํ•ด๊ฒฐ๋˜๋Š” ๊ฒƒ์„ ๋ณผ ์ˆ˜ ์žˆ์Œ.

728x90
๋ฐ˜์‘ํ˜•

'๊ฐœ๋ฐœ ยท๊ณต๋ถ€ > ETC' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๋‹ค๋ฅธ ๊ธ€

[JAVA] ์ฝ”๋“œ ์ทจ์†Œ์„  (Deprecated)  (0) 2022.05.03
[Jupyter Notebook] ๋‹จ์ถ•ํ‚ค ๋ชจ์Œ  (0) 2021.10.18

+ Recent posts