matplotlib 그래프 그리기

3767 단어 matplotlibmatplotlib

matplotlib

1. pie chart

import matplotlib.pyplot as plt
from matplotlib import font_manager, rc
import numpy as np

font_path = "/usr/share/fonts/truetype/nanum/NanumGothic.ttf"
font = font_manager.FontProperties(fname=font_path).get_name()
rc('font', family=font)

labels = pd.array(df2[:5]['official_text'])
frequency = pd.array(df2[:5]['cnt'])
cake = pd.DataFrame({'frequency':frequency}, 
                   index = labels) 
cake['frequency'].plot(kind='pie',figsize=(8,8),autopct = '%1.1f%%', fontsize = 13,legend = True)

Reference

https://truman.tistory.com/103

좋은 웹페이지 즐겨찾기