Search code examples
pythonpandasmatplotlibpie-chart

Plotting Pandas DataFrames in to Pie Charts using matplotlib


Is it possible to print a DataFrame as a pie chart using matplotlib? The Pandas documentation on chart visualization has instructions for plotting lot of chart types including bar, histogram, scatter plot etc. But pie chart is missing?


Solution

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

    seems to work as expected. If the DataFrame has more than one column, it will raise.