Skip to content

Instantly share code, notes, and snippets.

@sinhrks
Created April 27, 2014 00:45
Show Gist options
  • Save sinhrks/11334907 to your computer and use it in GitHub Desktop.
Save sinhrks/11334907 to your computer and use it in GitHub Desktop.
Pandas plotting with pie
import pandas as pd
import numpy as np
import pandas.util.testing as tm
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
series = pd.Series(3 * np.random.rand(4), index=['a', 'b', 'c', 'd'], name='series')
series.plot(kind='pie', legend=True)
plt.show()
df = pd.DataFrame(3 * np.random.rand(4, 2), index=['a', 'b', 'c', 'd'], columns=['x', 'y'])
df.plot(kind='pie', subplots=True)
plt.show()
series.plot(kind='pie', labels=['AA', 'BB', 'CC', 'DD'], colors=['r', 'g', 'b', 'c'],
autopct='%.2f', fontsize=20)
plt.show()
@sinhrks
Copy link
Author

sinhrks commented Apr 27, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment