Linked Questions

Popular Questions

bar chart over pandas DataFrame

Asked by At

I have dataframe like this:

     Continent        Surplus1980  Surplus1985     ...       Surplus2005  Surplus2010

       Africa         -711.186834  -894.362995     ...      -1001.189049  -960.203280
       Asia          -1464.995609 -1528.688190     ...      -1511.834129 -1529.459409
       Europe          716.832130   580.341819     ...        574.808741   590.688746
       North America  1586.628358  2559.054466     ...       2851.819722  2867.880633
       Oceania        4163.456825  3899.532718     ...       3807.652781  3796.396563
       South America  1455.955084  1196.506188     ...       1086.940969  1093.484142

Now I want to plot a bar-chart that shows each continent value from 1980 to 2010 in the x-axis. I am using this function:

df.plot(kind="bar", rot=0, ax=ax, width=0.5)  

my result shows me:
bar-chart

So how I can change to have continent name in the legend and for each year shows me the value of each continent?

Related Questions