小编Ash*_*noy的帖子

根据特定条件对散点图点进行不同的着色

我有一个使用plotly.py制作的散点图,我想根据特定条件用不同的颜色为散点图中的某些点着色。我在下面附上了示例代码:

import plotly.plotly as py
import plotly.graph_objs as go
from plotly.offline import plot

data = [4.1, 2.1, 3.1, 4.4, 3.2, 4.1, 2.2]

trace_1 = go.Scatter(
    x = [1, 2, 3, 4, 5, 6, 7],
    y = data
)

layout = go.Layout(
    paper_bgcolor='rgb(255,255,255)',
    plot_bgcolor='rgb(229,229,229)',
    title = "Sample Plot",
    showlegend = False,
    xaxis = dict(
        mirror = True,
        showline = True,
        showticklabels = True,
        ticks = 'outside',
        gridcolor = 'rgb(255,255,255)',
    ),
    yaxis = dict(
        mirror = True,
        showline = True,
        showticklabels = …
Run Code Online (Sandbox Code Playgroud)

plotly-dash plotly-python

1
推荐指数
1
解决办法
8041
查看次数

标签 统计

plotly-dash ×1

plotly-python ×1