[英]Maximum number of vertical subplots in plotly figure
I can't seem to get the spacing right for vertical subplots in plotly. 我似乎无法正确地绘制垂直子图的间距。 Currently, my figure looks like this: 目前,我的图看起来像这样:
There are a couple of things that I would like to fix: 我想修正几件事:
1) Increase the amount of space between subplots, and just make the figure larger 1)增加子图之间的空间,并增大图的大小
2) Increase the size of each y-axis so that the tick labels aren't overlapping. 2)增大每个y轴的尺寸,以使刻度标签不重叠。
I don't see any arguments in the plotly.tools.make_subplots
function that controls the size of the figure. 我在控制图形大小的plotly.tools.make_subplots
函数plotly.tools.make_subplots
不到任何参数。 If there is some way to make the figure larger so that each plot has more space, that would be great. 如果有某种方法可以使图形更大,以便每个图都有更多空间,那将是很好的。
A minimal reproducible example 一个最小的可复制示例
import plotly
plotly.offline.init_notebook_mode()
import random
rows = 10
traces = [[random.random() for j in range(100)] for i in range(rows)]
fig = plotly.tools.make_subplots(rows=rows, cols=1)
for i in range(1, rows + 1):
p = plotly.graph_objs.Bar(y=traces[i - 1], showlegend=False)
fig.append_trace(p, i, 1)
plotly.offline.iplot(fig)
produces 产生
1) Increase the amount of space between subplots, and just make the figure larger 1)增加子图之间的空间,并增大图的大小
2) Increase the size of each y-axis so that the tick labels aren't overlapping. 2)增大每个y轴的尺寸,以使刻度标签不重叠。
You can use vertical_spacing
in combination with layout['height']
to address both issues at the same time. 您可以结合使用vertical_spacing
和layout['height']
来同时解决这两个问题。
fig = plotly.tools.make_subplots(rows=rows, cols=1, vertical_spacing=0.5/rows)
fig['layout'].update(height=1000)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.