Skip to content

Latest commit

 

History

History
128 lines (99 loc) · 2.51 KB

configuration-options.md

File metadata and controls

128 lines (99 loc) · 2.51 KB
jupyter
jupytext kernelspec language_info plotly
notebook_metadata_filter text_representation
all
extension format_name format_version jupytext_version
.md
markdown
1.1
1.1.7
display_name language name
Python 3
python
python3
codemirror_mode file_extension mimetype name nbconvert_exporter pygments_lexer version
name version
ipython
3
.py
text/x-python
python
python
ipython3
3.6.5
description display_as has_thumbnail ipynb language layout name order page_type permalink thumbnail title v4upgrade
How to set configuration options of plotly graphs in python. Examples of both online and offline configurations.
file_settings
true
~notebook_demo/97
python
base
Configuration
7
u-guide
python/configuration-options/
thumbnail/modebar-icons.png
Configuration | plotly
true

Offline Configuration Options

Now you can pass a config dictionary with all configurations options such as scrollZoom, editable, and displayModeBar. For the complete list of config options check out: https://github.com/plotly/plotly.js/blob/master/src/plot_api/plot_config.js

Enable Scroll Zoom
import plotly.graph_objects as go

fig = go.Figure()

fig.add_trace(
    go.Scatter(
        x=[1, 2, 3],
        y=[1, 3, 1]))

fig.show(config={'scrollZoom': True})
Display ModeBar
import plotly.graph_objects as go

fig = go.Figure()

fig.add_trace(
    go.Scatter(
        x=[1, 2, 3],
        y=[1, 3, 1]))

fig.show(config={'displayModeBar': True})
Edit Mode - change the title and axis titles
import plotly.graph_objects as go

fig = go.Figure()

fig.add_trace(
    go.Scatter(
        x=[1, 2, 3],
        y=[1, 3, 1]))

fig.show(config={'editable': True})
Multiple Config Options at Once!
import plotly.graph_objects as go

fig = go.Figure()

fig.add_trace(
    go.Scatter(
        x=[1, 2, 3],
        y=[1, 3, 1]))

fig.show(config={
    'scrollZoom': True,
    'displayModeBar': True,
    'editable': True
})
Remove Modebar Buttons
import plotly.graph_objects as go

fig = go.Figure()

fig.add_trace(
    go.Scatter(
        x=[1, 2, 3],
        y=[1, 3, 1]))

fig.show(config={
    'modeBarButtonsToRemove': ['toggleSpikelines','hoverCompareCartesian']
})

Reference

See config options at https://github.com/plotly/plotly.js/blob/master/src/plot_api/plot_config.js#L6