plotly - 在破折号中调整图形的大小
问题描述
我正在尝试调整用图形工厂制作的 Dash 中的绘图图的大小。我知道如何更改常规graph.Obj 布局中的大小,但这不适用于我的图形工厂图。
我试图调整大小的图形函数是:
fig_map = ff.create_choropleth(fips=df['x'].tolist(),
values=df['y'].tolist(), scope=[state],
binning_endpoints=endpts,colorscale=DEFAULT_COLORSCALE,
county_outline={'color': 'rgb(255,255,255)', 'width': 0.5},
round_legend_values=True, legend_title='Population by County')
好像我想要类似的东西
fig_map.layout.update({'height':800})
从此页面https://plot.ly/python/figure-factory-subplots/#plotlys-figure-factory-module,但在我的仪表板应用程序中尝试时出错。这也不会改变大小:
fig_map={
'layout': go.Layout(
height=800,
)}
任何建议都会很棒。
解决方案
您可以尝试height
在“布局”中指定或更新他:
data=[fig_map]
layout = go.Layout(
autosize=False,
width=1000,
height=1000,
title="fig_map")
fig = go.Figure(data=data,layout=layout)
fig['layout'].update(width=500, height=500, autosize=False)
plotly.offline.plot(fig, filename='fig_map')
推荐阅读
- python - Python MySQL 连接器不适用于 SSL
- android - 颤振饼图 labelAccessorFn 不起作用
- android - Flutter cloud_firestore 错误:找不到符号 > @Nullable
- lit-html - lit-html:如何只听点击源元素而不是子元素
- python - 使用 platformio-ide-terminal 运行 python 代码
- c - .../libgcc.a 中的隐藏符号“__udivti3”被 DSO 引用
- postgresql - postgresql 禁止修改 pg_hba 连接
- spss - 在 MDS 图中添加类别
- javascript - 位置改变时如何获取列表项的索引值
- java - Android firestore 云函数 SnapshotListener 更新缓存并获取最新文档的字段