如何插入 Plotly Gauge(不是 Indicator)作为子图?

How to insert a Plotly Gauge (not an Indicator) as subplot?

python 版本 3.8; plotly 5.3.1; dash_daq0.5.0

有一个图有 3 个子图:散点图、指示器和仪表。

如何设置无花果的specs插入量规?或者它只是一个量规与[=不兼容 15=]?

我需要插入 GAUGE,而不是 INDICATOR,因为指示器(据我所知)不像旧转速表那样提供“臂”。从远处看面板,仪表的手臂更明显。 (我不需要关于如何更改颜色等的评论。仅关于插入仪表。)

我查看了 https://plotly.com/python/subplots/#subplots-types,但没有找到任何可能的解决方案提示。

作为一个与我的问题只有轻微关系的好奇心,当我们添加每条轨迹时它可以自动确定时,为什么有必要指定绘图类型?

from plotly.graph_objs.scatter import Line
from plotly.subplots import make_subplots
import plotly.graph_objs as go
import dash_daq as daq

trace1 = go.Scatter(
    x = [0, 1, 2],
    y = [0, 8, 6]
)

indicator1 = go.Indicator(
    value = 6,
    mode = "gauge+number",
)

gauge1 = daq.Gauge(
    min=0,
    max=10,
    value=6
)

fig = make_subplots(rows=1, cols=3, specs=[[
    {'type':'xy'},
    {'type':'domain'},
    {'type':'domain'}]]                   # <========== ???
)

fig.append_trace(trace1, row=1, col=1)
fig.append_trace(indicator1, row=1, col=2)
# fig.append_trace(gauge1, row=1, col=3)  # <========== uncomment here!

fig.show()

a dash daq gauge 不是 plotly trace 所以不能添加到 plotly 图为轨迹。如果您正在构建破折号应用程序,则可以通过破折号布局来实现。您可以将 plotly indicator 作为跟踪/子图添加到 plotly,而不是站立它们有不同能力