반응형
Recent Posts
Recent Comments
관리 메뉴

개발잡부

[matplotlib] pie chart sample 1 본문

Python/matplotlib

[matplotlib] pie chart sample 1

닉의네임 2022. 8. 19. 14:37
반응형
import matplotlib.pyplot as plt
import numpy as np

plt.style.use('_mpl-gallery-nogrid')


# make data
x = [1, 2, 3, 4]
colors = plt.get_cmap('Blues')(np.linspace(0.2, 0.7, len(x)))

# plot
fig, ax = plt.subplots()
ax.pie(x, colors=colors, radius=3, center=(4, 4),
       wedgeprops={"linewidth": 1, "edgecolor": "white"}, frame=True)

ax.set(xlim=(0, 8), xticks=np.arange(1, 8),
       ylim=(0, 8), yticks=np.arange(1, 8))

plt.show()

반응형

'Python > matplotlib' 카테고리의 다른 글

[matplotlib] legend picking chart sample  (0) 2022.08.19
[matplotlib] two subplot chart sample 1  (0) 2022.08.19
[matplotlib] line chart sample 2  (0) 2022.08.19
[matplotlib] line chart sample 1  (0) 2022.08.19
[matplotlib] 한글깨짐  (0) 2022.01.18
Comments