可能是一个错误...当使用Plotly的fig_factory制作构面网格时,我无法正确映射数据以显示为工具提示。
import plotly.offline as py
import plotly.figure_factory as ff
import pandas as pd
mpg = pd.read_table('https://raw.githubusercontent.com/plotly/datasets/master/mpg_2017.txt')
eight_cyl = mpg[mpg['cyl'] == 8]
print(eight_cyl[eight_cyl['displ'] == 7.0])
fig = ff.create_facet_grid(
mpg,
x='displ',
y='cty',
facet_col='cyl',
text=mpg['trans']
)
py.plot(fig)
从数据上看,雪佛兰Corvette 8气缸具有手动(m6)变速箱:
manufacturer model displ year cyl trans drv cty hwy fl
chevrolet corvette 7.0 2008 8 manual(m6) r 15 24 p
如何正确将数据映射到标记?