繁体   English   中英

我可以使用 plotly 子图在一张图表 object 中显示不同的图表类型,例如雷达、旭日形、甜甜圈吗

[英]Can i show different chart types eg radar, sunburst, doughnut in one graph object using plotly subplots

我已尝试使用以下代码将雷达图和旭日图显示为一张图中的两列 object

But I get the below error...
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/em/.local/lib/python3.8/site-packages/plotly/subplots.py", line 436, in make_subplots
    raise ValueError(
ValueError: 
The 'specs' argument to make_subplots must be a 2D list of dictionaries with dimensions (1 x 2).
    Received value of type <class 'list'>: [{'type': 'radar'}, {'type': 'polar'}]

是否可以使用 plotly 在一个图形 object 中创建这种类型的多种图表类型。

由于子图可以放置在许多行和列中,因此您必须在规范中提供 2D 数组。 因此,您必须传递list of lists of dict而不是list of dicts列表。

fig = make_subplots(rows=1, cols=2,
                    specs=[  # first row
                        [
                            {'type': 'radar'},  # first col
                            {'type': 'polar'}  # second col
                        ]
                    ])

您还可以在docs中找到更多用法和示例。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM