plotly子图:是否可以让一个子图占据多个列或行?

huangapple go评论67阅读模式
英文:

plotly subplots: is it possible to have one subplots occupy multiple columns or rows

问题

我正在尝试使用Plotly子图在一个图上绘制3个图。自然地,我可以只用3行,但我想要前两个图并排,另一个图被拉长。总体上,我想要在图片上获得以下布局(我用画图软件绘制的):
plotly子图:是否可以让一个子图占据多个列或行?
是否有可能实现这个布局,如果可以,如何实现?

英文:

I am trying to have 3 plots on one figure using plotly subplots.
Naturally, I could do just 3 rows but I am trying to have first two figures side-by-side and another being stretched out. Overall I am trying to get a layout on the picture (that I made with paint):
plotly子图:是否可以让一个子图占据多个列或行?
Is it possible and if yes how can I achieve this ?

答案1

得分: 0

文档示例中,使用规格定义多列跨度:

from plotly.subplots import make_subplots
import plotly.graph_objects as go

fig = make_subplots(
    rows=2, cols=2,
    specs=[[{}, {}],
           [{"colspan": 2}, None]],
    subplot_titles=("第一个子图", "第二个子图", "第三个子图"))
英文:

From the documentation examples, using specs to define multi col span:

from plotly.subplots import make_subplots
import plotly.graph_objects as go

fig = make_subplots(
    rows=2, cols=2,
    specs=[[{}, {}],
           [{"colspan": 2}, None]],
    subplot_titles=("First Subplot","Second Subplot", "Third Subplot"))

huangapple
  • 本文由 发表于 2023年3月3日 21:14:14
  • 转载请务必保留本文链接:https://go.coder-hub.com/75627541.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定