简体   繁体   English

如何从图中删除 plotly 徽标(“Produced with plotly”)

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

By default a plotly plot has their logo with text like "Produced with plotly" (top right).默认情况下,plotly plot 的徽标带有“Produced with plotly”(右上角)等文本。 I have a premium account and would like to remove that logo.我有高级帐户并想删除该徽标。

Here is a little code snippet that does the final plot:这是执行最终 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')

With "'displaylogo': False" in config I expected the logo being removed.在配置中使用“'displaylogo':False”我希望徽标被删除。 But it doesn't.但事实并非如此。

This is what I got from the official page这是我从官方页面得到的

Hide the Plotly Logo on the Modebar 隐藏模式栏上的 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});

Your mentioned config should be put in fig.show() method or in dcc.graph(), same as follow:您提到的配置应该放在 fig.show() 方法或 dcc.graph() 中,如下所示:

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

or或者

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM