2017-08-03 24 views
0

透明传说我检查了大熊猫的资料绘制与pandas.plot

pd.df.plot

,但我找不到任何选项,以使传说透明

我知道如何与matplotlib

subplot.legend(loc='best', fancybox=True, framealpha=0.5) 

,但我需要使用熊猫数据帧情节

有什么想法?

回答

3

Plotting a Pandas DataFrame返回一个Matplotlib axis对象。这个保存到一个变量,然后后来调整传说设置:

ax = df.plot() 
ax.legend(loc='best', fancybox=True, framealpha=0.5) 

例子:

import pandas as pd 
import matplotlib 

df = pd.DataFrame({"A": [0,1]}) 
ax = df.plot() 
ax.legend(loc='best', fancybox=True, framealpha=0.5) 
ax.plot() 

enter image description here

+0

如果这个工作你能笑纳答案吗? – harryscholes