Pandas bar plot with specific colors and legend location?

后端 未结 2 1293
终归单人心
终归单人心 2020-12-24 13:23

I have a pandas DataFrame and I want to plot a bar chart that includes a legend.

import pylab as pl
from pandas import *

x = DataFrame({\"Alpha         


        
2条回答
  •  悲哀的现实
    2020-12-24 14:04

    The most succinct way to go is:

    x.plot(kind="bar").legend(bbox_to_anchor=(1.2, 0.5))
    

    or in general

    x.plot(kind="bar").legend(*args, **kwargs)
    

提交回复
热议问题