簡體   English   中英

如何從圖中刪除 plotly 徽標(“Produced with plotly”)

[英]How to remove plotly logo ("Produced with plotly") from plots

默認情況下,plotly plot 的徽標帶有“Produced with plotly”(右上角)等文本。 我有高級帳戶並想刪除該徽標。

這是執行最終 plot 的一小段代碼片段:

plotly.tools.set_credentials_file(username='username', api_key='xxxxxxx')
list_df = pd.read_csv('my_csv_file.csv')

names_df = list_df['Name']

trace = go.Scatter(
    x = list_df['Abc'],
    y = list_df['Xyz'],
    visible=True,
    text=names_df,
    hoverinfo = 'text',
    hoverlabel=dict(bgcolor='white'),
    name='ABC',
    line = dict(color='#17BECF'),
    mode = "markers",
    marker=dict(size=8),
    showlegend=False,
    opacity = 0.8
)

data = [trace]

layout = go.Layout(
    title='Lyout Name',
    hovermode = 'closest',

    xaxis=dict(
        title='Title X axis',
        titlefont=dict(
            family='Courier New, monospace',
            size=18,
            color='#7f7f7f'
        )
    ),
    yaxis=dict(
        title='Title Y axis',
        titlefont=dict(
            family='Courier New, monospace',
            size=18,
            color='#7f7f7f'
        )
    )
)

config = {
    'scrollZoom': False,
    'displayModeBar': True,
    'editable': True,
    'showLink':False,
    'displaylogo': False
}

fig = dict(data=data, layout=layout)

py.plot(fig, filename='Filename', auto_open=False, config=config, sharing='secret')

在配置中使用“'displaylogo':False”我希望徽標被刪除。 但事實並非如此。

這是我從官方頁面得到的

隱藏模式欄上的 Plotly Logo

 var trace1 = { x:['trees', 'flowers', 'hedges'], y: [90, 130, 40], type: 'bar' }; var data = [trace1]; var layout = { title: 'Hide the Plotly Logo on the Modebar', showlegend: false }; Plotly.newPlot('myDiv', data, layout, {displaylogo: false});

您提到的配置應該放在 fig.show() 方法或 dcc.graph() 中,如下所示:

fig.show(id='the_graph', config= {'displaylogo': False})

或者

dcc.Graph(id='the_graph', config= {'displaylogo': False})

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM