Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove the Undo button in plotly dash after a dropdown update

After updating a dropdown box in Plotly Dash, an undo button appears down the bottom left of the screen, and doesn't go away.

How do I remove it?

like image 674
Tom Malkin Avatar asked Jul 17 '17 06:07

Tom Malkin


1 Answers

MAY 2019 UPDATE
Starting in Dash 1.0 the Undo button is hidden by default. #724
To turn the Undo/Redo button back on use: app = dash.Dash(show_undo_redo=True)

AUG 2018 UPDATE: There is currently an issue out on GitHub to add a feature into Dash to do this for you. You can check its status here to see if it has been implemented yet.

You can do this by attaching external css. You can append external css with the following code:

app.css.append_css({
   'external_url': (
       'link-to-your-css'
   )
})

In your css code you will want to have the line:

._dash-undo-redo {
  display: none;
}

for example, some of my css where I turn the undo button of is: https://cdn.jsdelivr.net/gh/lwileczek/Dash@master/v5.css

if you make a css file on github you can use https://www.jsdelivr.com/ to create a url to post in "append_css". If you do this, make sure your file ends with .css

currently, this link is exactly what you need, but if you have other css you'll have to create a new css file. https://cdn.jsdelivr.net/gh/lwileczek/Dash@master/v5.css

furthermore, if you don't like all the buttons added to your graphs, when you create a graph you can hide them with the following code

 dcc.Graph(id='my_graph',config={'displayModeBar': False})

I found a very similar question posted on plotly's own forum. Their lead developer responds often. Here is his response to this: https://community.plot.ly/t/is-it-possible-to-hide-the-floating-toolbar/4911/11 Hope this helps. Let me know if there are further questions.


Exact code needed.

app.css.append_css({'external_url': ( 
    'cdn.jsdelivr.net/gh/lwileczek/Dash@master/v5.css'
)}) 
like image 127
lwileczek Avatar answered Oct 16 '22 11:10

lwileczek