gis*_*s20 0 python plot transparency pandas
我检查了熊猫图的文件
但我找不到任何使图例透明的选项
我知道如何使用matplotlib
subplot.legend(loc='best', fancybox=True, framealpha=0.5)
Run Code Online (Sandbox Code Playgroud)
但我需要使用熊猫数据框图
任何的想法?
绘制熊猫图DataFrame将返回Matplotlib axis对象。将其保存到变量,然后调整图例设置:
ax = df.plot()
ax.legend(loc='best', fancybox=True, framealpha=0.5)
Run Code Online (Sandbox Code Playgroud)
例:
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()
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
874 次 |
| 最近记录: |