Cla*_*ire 14 python data-visualization plotly
add_tracePlotly和Plotly之间有什么区别吗append_trace?后者是前者的遗产吗?
在Plotly.py GitHub中,有 88 个 markdown + 21 个 Python 实例add_trace和 9 个 markdowbn + 7 个 Python 实例append_trace。后者主要来自doc和packages/python/plotly/plotly/figure_factory。
在Plotly subplots 文档中,有 4 个实例,append_trace而所有其他 52 个实例都是add_trace。
这是从那里提取的一个示例:
from plotly.subplots import make_subplots
import plotly.graph_objects as go
fig = make_subplots(rows=3, cols=1)
fig.append_trace(go.Scatter(
x=[3, 4, 5],
y=[1000, 1100, 1200],
), row=1, col=1)
fig.append_trace(go.Scatter(
x=[2, 3, 4],
y=[100, 110, 120],
), row=2, col=1)
fig.append_trace(go.Scatter(
x=[0, 1, 2],
y=[10, 11, 12]
), row=3, col=1)
fig.update_layout(height=600, width=600, title_text="Stacked Subplots")
fig.show()
Run Code Online (Sandbox Code Playgroud)
我尝试append_trace将此代码片段中的实例替换为add_trace,但没有观察到任何明显的差异。