Monday, April 20, 2020

pie chart in seaborn library using python

import pandas as pd

# --- dataset 2: 3 columns and rownames
df = pd.DataFrame({'var1':[8,3,4,2], 'var2':[1,3,4,1]}, index=['a', 'b', 'c', 'd'] )

# make the multiple plot
df.plot(kind='pie', subplots=True, figsize=(16,8))




import pandas as pd
 
# --- dataset 2: 3 columns and rownames
df = pd.DataFrame({'var1':[8,3,4,2], 'var2':[1,3,4,1]}, index=['a', 'b', 'c', 'd'] )
 
# make the multiple plot
df.plot(kind='pie', subplots=True, figsize=(16,8))
Out[3]:
array([<matplotlib.axes._subplots.AxesSubplot object at 0x000001BBCAB27408>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x000001BBCAB5E1C8>],
      dtype=object)
In [7]:
import pandas as pd
 
# --- dataset 2: 3 columns and rownames
df = pd.DataFrame({'var1':[4,4,4,4], 'var2':[1,3,4,1]}, index=['a', 'b', 'c', 'd'] )
 
# make the multiple plot
df.plot(kind='pie', subplots=True, figsize=(16,8))
Out[7]:
array([<matplotlib.axes._subplots.AxesSubplot object at 0x000001BBCB0BA6C8>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x000001BBCB0E8F88>],
      dtype=object)
In [8]:
import pandas as pd
 
# --- dataset 2: 3 columns and rownames
df = pd.DataFrame({'var1':[4,4,4,4], 'var2':[1,3,4,1]}, index=['a', 'b', 'c', 'd'] )
 
# make the multiple plot
df.plot(kind='pie', subplots=True, figsize=(10,8))
Out[8]:
array([<matplotlib.axes._subplots.AxesSubplot object at 0x000001BBCB17E4C8>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x000001BBCB315788>],
      dtype=object)
In [9]:
import pandas as pd
 
# --- dataset 2: 3 columns and rownames
df = pd.DataFrame({'var1':[4,4,4,4], 'var2':[2,3,4,1]}, index=['a', 'b', 'c', 'd'] )
 
# make the multiple plot
df.plot(kind='pie', subplots=True, figsize=(10,8))
Out[9]:
array([<matplotlib.axes._subplots.AxesSubplot object at 0x000001BBCB554DC8>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x000001BBCB57DC88>],
      dtype=object)
In [ ]:
 

No comments:

Post a Comment

python class topic video