Created
April 27, 2014 00:45
-
-
Save sinhrks/11334907 to your computer and use it in GitHub Desktop.
Pandas plotting with pie
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Example for
pandas-dev/pandas#6976