【发布时间】:2018-07-25 14:46:40
【问题描述】:
我们如何在 Plotly 的子图中制作多面网格?例如,我想在子图中将total_bill 与tip 绘制五次。我厌倦了以下操作:
import plotly.plotly as py
import plotly.figure_factory as ff
from plotly import tools
subfigs = tools.make_subplots(rows= 5, cols=1)
import pandas as pd
tips = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/tips.csv')
for i in enumerate(tips.columns.tolist()):
fig = ff.create_facet_grid(
tips,
x='total_bill',
y='tip',
color_name='sex',
show_boxes=False,
marker={'size': 10, 'opacity': 1.0},
colormap={'Male': 'rgb(165, 242, 242)', 'Female': 'rgb(253, 174, 216)'}
)
subfigs.append_trace(fig, i+1, 1)
pyo.iplot(fig)
这不起作用,因为图形工厂创建的多面网格不被视为跟踪。有没有办法做到这一点? This 回答没有帮助,因为在我看来 cufflinks 不接受多面网格
【问题讨论】:
标签: python plotly subplot facet-grid