如何使Plotly交互式折线图更加鲜明?

时间:2018-07-06 06:28:23

标签: python pandas graph plotly

我要划出一条线,如果将鼠标悬停在上面,它将比周围的其他线更加突出。

是否有一种方法可以使周围的其他线条逐渐消失但不能完全消失?

layout = go.Layout(
    title = 'FIFA rankings',
    titlefont = dict(size = 22),
    yaxis = dict(
        title = 'Rankings',
        titlefont = dict(size = 20),
        tickfont = dict(size = 14),
        gridcolor = 'rgb(0, 0, 0)',
        autorange='reversed',
        zeroline = False
    ),
    xaxis = dict(
        title = 'Years',
        titlefont = dict(size = 20),
        tickfont = dict(size = 15),
        visible = True,
        gridcolor = 'rgb(0, 0, 0)',
        zeroline = False,
        zerolinewidth = 0
    )
)

data = [go.Scatter(
        x = Brazil['Year'], 
        y = Brazil['Ranking'],
        mode = 'lines+markers',
        name='Brazil',
        line = dict(shape = 'linear'),
        marker={'color': 'red'}
    ),go.Scatter(
        x = Uruguay['Year'],
        y = Uruguay['Ranking'],
        mode = 'lines+markers',
        name = 'Uruguay',
        line = dict(shape = 'linear'),
        marker={'color': 'blue'}
    ), go.Scatter(
        x = Sweden['Year'],
        y = Sweden['Ranking'],
        mode = 'lines+markers',
        name = 'Sweden',
        line = dict(shape = 'linear'),
        marker={'color': 'green'}
    ), go.Scatter(
        x = England['Year'],
        y = England['Ranking'],
        mode = 'lines+markers',
        name = 'England',
        line = dict(shape = 'linear'),
        marker={'color': 'cyan'}
    ), go.Scatter(
        x = Russia['Year'],
        y = Russia['Ranking'],
        mode = 'lines+markers',
        name = 'Russia',
        line = dict(shape = 'linear'),
        marker={'color': 'black'}
    ), go.Scatter(
        x = France['Year'],
        y = France['Ranking'],
        mode = 'lines+markers',
        name = 'France',
        line = dict(shape = 'linear'),
        marker={'color': 'magenta'}
    ), go.Scatter(
        x = Belgium['Year'],
        y = Belgium['Ranking'],
        mode = 'lines+markers',
        name = 'Belgium',
        line = dict(shape = 'linear'),
        marker={'color': 'brown'}
    )]


fig = go.Figure(data = data, layout = layout)

py.offline.iplot(fig)

enter image description here

如果我没有正确地解释自己,请这么做,我会尽力阐述自己。

0 个答案:

没有答案