是否有任何函数可以使用python在Plotly中绘制类似于geom_smooth()的函数?

时间:2016-08-02 18:05:08

标签: python plotly

我使用Plotly(python)创建了一个散点图,我想使用类似于geom_smooth()函数的点连接点。

如下图所示: enter image description here

1 个答案:

答案 0 :(得分:1)

您应该可以通过在定义线条时设置shape ='spline'来实现。这是一个阴谋的例子

trace2 = go.Scatter(
    x=[1, 2, 3, 4, 5],
    y=[6, 8, 7, 8, 6],
    mode='lines+markers',
    name="'spline'",
    text=["tweak line smoothness<br>with 'smoothing' in line object"],
    hoverinfo='text+name',
    line=dict(
        shape='spline'
    )
)

请在此处查看示例:plotly line charts