ABSTRACT

By default, the modebar appears in the top right-hand side of a plotly graph on mouse hover, and can lead to poor user-experience on small displays. Fortunately, the modebar can be completely customized via the config() function. It is possible to supply the readers' own modebar button icon that triggers a custom JavaScript function when clicked. They must provide a name for the icon and either a SVG path or a full SVG element. To define a JavaScript function to call upon clicking the icon, they can provide a string to htmlwidgets::JS(). By default, the toImage modebar button downloads a PNG file using the current size and state of the graph. Note that the readers can also use modeBarButtons to completely specify which buttons to include in the modebar.