Planning Pandas DataFrames in to Pie Charts using matplotlib

2 answers
import matplotlib.pyplot as plt
plt.pie(DataFrame([1,2,3]))

works as expected. If a DataFrame has more than one column, it will go up.

+5
source

Pandas pd.DataFrame.plot(). , , kind='pie' , ( subplots=True ). .

import matplotlib.pyplot as plt

df.Data.plot(kind='pie')

, :

fig = plt.figure(figsize=(6,6), dpi=200)
ax = plt.subplot(111)

df.Data.plot(kind='pie', ax=ax, autopct='%1.1f%%', startangle=270, fontsize=17)

DataFrame, ax=ax. matplotlib plt.pie(), .

+8

All Articles