Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/python/axes.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jupyter:
language: python
layout: base
name: Axes
order: 15
order: 16
permalink: python/axes/
thumbnail: thumbnail/axes.png
---
Expand Down
2 changes: 1 addition & 1 deletion doc/python/builtin-colorscales.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jupyter:
language: python
layout: base
name: Built-in Continuous Color Scales
order: 29
order: 30
permalink: python/builtin-colorscales/
thumbnail: thumbnail/heatmap_colorscale.jpg
v4upgrade: true
Expand Down
2 changes: 1 addition & 1 deletion doc/python/colorscales.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jupyter:
language: python
layout: base
name: Continuous Color Scales and Color Bars
order: 22
order: 23
permalink: python/colorscales/
redirect_from: python/logarithmic-color-scale/
thumbnail: thumbnail/heatmap_colorscale.jpg
Expand Down
5 changes: 5 additions & 0 deletions doc/python/configuration-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ If you don't set an option's value, it will automatically be set to the default

For the complete list of configuration options and their defaults see: https://github.com/plotly/plotly.js/blob/master/src/plot_api/plot_config.js

To let viewers edit titles, annotations, shapes, the legend, and related layout
fields on the chart itself, set `editable` to `True` in the figure config. See
[Editable Charts](/python/editable/) for the full list of properties that
mode enables.

### Enabling Scroll Zoom

This option allows users to zoom in and out of figures using the scroll wheel on their mouse and/or a two-finger scroll.
Expand Down
2 changes: 1 addition & 1 deletion doc/python/discrete-color.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jupyter:
language: python
layout: base
name: Discrete Colors
order: 30
order: 31
permalink: python/discrete-color/
thumbnail: thumbnail/heatmap_colorscale.jpg
v4upgrade: true
Expand Down
163 changes: 163 additions & 0 deletions doc/python/editable.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
---
jupyter:
jupytext:
notebook_metadata_filter: all
text_representation:
extension: .md
format_name: markdown
format_version: '1.3'
jupytext_version: 1.16.4
kernelspec:
display_name: Python 3 (ipykernel)
language: python
name: python3
language_info:
codemirror_mode:
name: ipython
version: 3
file_extension: .py
mimetype: text/x-python
name: python
nbconvert_exporter: python
pygments_lexer: ipython3
version: 3.9.19
plotly:
description: Which graph properties you can edit interactively when editable
is True in the figure config.
display_as: file_settings
language: python
layout: base
name: Editable Charts
order: 12
page_type: u-guide
permalink: python/editable/
thumbnail: thumbnail/modebar-icons.png
---

## Editable Charts

Set `editable` to `True` in the figure `config` to let viewers change some layout
properties directly on the chart (click text to edit it, drag to move or resize
items, and so on). This page lists those properties and shows them on one
example figure.

For other configuration keys, see [Configuration Options](/python/configuration-options/).

### Enable Editable Mode

Pass `config=dict(editable=True)` to `fig.show()`. In Dash, pass the same
dictionary to the `config` prop of `dcc.Graph`.

```python
import plotly.graph_objects as go

fig = go.Figure()
fig.add_trace(
go.Scatter(
x=[1, 2, 3, 4],
y=[10, 15, 13, 17],
mode="markers+lines",
name="Series A",
marker=dict(
size=12,
color=[1, 2, 3, 4],
colorscale="Viridis",
showscale=True,
colorbar=dict(title="Intensity"),
),
)
)
fig.add_trace(
go.Scatter(
x=[1, 2, 3, 4],
y=[16, 5, 11, 9],
mode="lines",
name="Series B",
)
)
fig.add_shape(
type="rect",
x0=1.5,
x1=2.5,
y0=8,
y1=14,
line=dict(color="RoyalBlue"),
fillcolor="LightSkyBlue",
opacity=0.4,
)
fig.add_annotation(
x=3.2,
y=17,
text="Click annotation text<br>or drag to move",
showarrow=True,
arrowhead=1,
)
fig.update_layout(
title="Click titles, legend, colorbar, or shape to edit",
xaxis_title="X Axis Title",
yaxis_title="Y Axis Title",
legend_title_text="Legend",
)

config = {
"editable": True,
# Optional: add / erase shapes from the modebar
"modeBarButtonsToAdd": [
"drawline",
"drawopenpath",
"drawclosedpath",
"drawcircle",
"drawrect",
"eraseshape",
],
}

fig.show(config=config)
```

Try the interactions below on the figure above:

- Click the **chart title**, **axis titles**, **legend entry names**, **annotation
text**, or **colorbar title** to edit the text
- Click axis-range endpoints to edit the **axis min / max**
- Drag the **legend** or **colorbar** to move them
- Drag the **annotation** text or arrowhead to reposition it
- Drag the **shape** edges to resize it, or its interior to move it
- Use the shape-drawing / erase buttons on the modebar to **add or remove shapes**

### Editable Properties

When `config["editable"]` is `True`, these graph properties can be edited in the
UI:

| Property | How to edit |
| --- | --- |
| Chart title | Click the title text |
| Axis titles | Click an axis title |
| Axis ranges (min and max) | Click the range endpoints |
| Shape position | Drag edges to resize; drag the center to move |
| Shape addition and removal | Use the shape-drawing and erase modebar buttons (add them with `modeBarButtonsToAdd` as above) |
| Annotation text | Click the annotation text |
| Annotation position | Drag the text or arrowhead |
| Legend trace names | Click a legend item name |
| Legend position | Drag the legend |
| Colorbar title | Click the colorbar title |
| Colorbar position | Drag the colorbar |

#### Shape polygon vertices

Dragging individual **polygon vertices** is a special case. Those handles are
available only when:

- the **individual shape** has `editable=True`, and
- chart-wide `config["editable"]` is `False`

See [Shapes](/python/shapes/) for examples that set `editable=True` on a shape
itself.

### Related

- [Configuration Options](/python/configuration-options/) — other `config` keys such as `scrollZoom` and modebar controls
- [Shapes](/python/shapes/) — drawing shapes and per-shape `editable`
- [Text and Annotations](/python/text-and-annotations/) — annotation layout
- [Legend](/python/legend/) — legend positioning and styling
2 changes: 1 addition & 1 deletion doc/python/figure-factories.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jupyter:
language: python
layout: base
name: Figure Factories
order: 34
order: 35
permalink: python/figure-factories/
thumbnail: thumbnail/streamline.jpg
---
Expand Down
2 changes: 1 addition & 1 deletion doc/python/figure-introspection.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jupyter:
language: python
layout: base
name: Introspecting Figures
order: 37
order: 38
page_type: u-guide
permalink: python/figure-introspection/
thumbnail: thumbnail/violin.jpg
Expand Down
2 changes: 1 addition & 1 deletion doc/python/figure-labels.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jupyter:
language: python
layout: base
name: Setting the Font, Title, Legend Entries, and Axis Titles
order: 14
order: 15
permalink: python/figure-labels/
redirect_from: python/font/
thumbnail: thumbnail/figure-labels.png
Expand Down
2 changes: 1 addition & 1 deletion doc/python/graph-objects.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jupyter:
language: python
layout: base
name: Graph Objects
order: 36
order: 37
page_type: u-guide
permalink: python/graph-objects/
thumbnail: thumbnail/horizontal-bar.jpg
Expand Down
2 changes: 1 addition & 1 deletion doc/python/graphing-multiple-chart-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jupyter:
language: python
layout: base
name: Multiple Chart Types
order: 19
order: 20
page_type: u-guide
permalink: python/graphing-multiple-chart-types/
thumbnail: thumbnail/multiple-chart-type.jpg
Expand Down
2 changes: 1 addition & 1 deletion doc/python/horizontal-vertical-shapes.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jupyter:
language: python
layout: base
name: Horizontal and Vertical Lines and Rectangles
order: 38
order: 39
permalink: python/horizontal-vertical-shapes/
thumbnail: thumbnail/shape.jpg
---
Expand Down
2 changes: 1 addition & 1 deletion doc/python/hover-text-and-formatting.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jupyter:
language: python
layout: base
name: Hover Text and Formatting
order: 24
order: 25
permalink: python/hover-text-and-formatting/
thumbnail: thumbnail/hover-text.png
---
Expand Down
2 changes: 1 addition & 1 deletion doc/python/images.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jupyter:
language: python
layout: base
name: Images
order: 25
order: 26
permalink: python/images/
thumbnail: thumbnail/images.png
v4upgrade: true
Expand Down
2 changes: 1 addition & 1 deletion doc/python/interactive-html-export.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jupyter:
language: python
layout: base
name: Interactive HTML Export
order: 32
order: 33
page_type: u-guide
permalink: python/interactive-html-export/
thumbnail: thumbnail/static-image-export.png
Expand Down
2 changes: 1 addition & 1 deletion doc/python/ipython-vs-python.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jupyter:
language: python
layout: base
name: IPython vs Python
order: 27
order: 28
permalink: python/ipython-vs-python/
thumbnail: thumbnail/venn.jpg
---
Expand Down
2 changes: 1 addition & 1 deletion doc/python/legend.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jupyter:
language: python
layout: base
name: Legends
order: 16
order: 17
permalink: python/legend/
redirect_from: python/horizontal-legend/
thumbnail: thumbnail/legends.gif
Expand Down
2 changes: 1 addition & 1 deletion doc/python/marker-style.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jupyter:
language: python
layout: base
name: Styling Markers
order: 21
order: 22
permalink: python/marker-style/
thumbnail: thumbnail/marker-style.gif
---
Expand Down
2 changes: 1 addition & 1 deletion doc/python/multiple-axes.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jupyter:
language: python
layout: base
name: Multiple Axes
order: 17
order: 18
permalink: python/multiple-axes/
thumbnail: thumbnail/multiple-axes.jpg
---
Expand Down
2 changes: 1 addition & 1 deletion doc/python/pandas-backend.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jupyter:
language: python
layout: base
name: Pandas Plotting Backend
order: 33
order: 34
permalink: python/pandas-backend/
redirect_from: python/cufflinks/
thumbnail: thumbnail/plotly-express.png
Expand Down
2 changes: 1 addition & 1 deletion doc/python/px-arguments.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jupyter:
language: python
layout: base
name: Plotly Express Arguments
order: 20
order: 21
page_type: u-guide
permalink: python/px-arguments/
thumbnail: thumbnail/plotly-express.png
Expand Down
2 changes: 1 addition & 1 deletion doc/python/selections.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jupyter:
language: python
layout: base
name: Selections
order: 39
order: 40
permalink: python/selections/
thumbnail: thumbnail/ml_apps.png
---
Expand Down
2 changes: 1 addition & 1 deletion doc/python/setting-graph-size.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jupyter:
language: python
layout: base
name: Setting Graph Size
order: 12
order: 13
permalink: python/setting-graph-size/
thumbnail: thumbnail/sizing.png
---
Expand Down
2 changes: 1 addition & 1 deletion doc/python/shapes.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jupyter:
language: python
layout: base
name: Shapes
order: 26
order: 27
permalink: python/shapes/
thumbnail: thumbnail/shape.jpg
---
Expand Down
2 changes: 1 addition & 1 deletion doc/python/static-image-generation-migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jupyter:
language: python
layout: base
name: Static Image Generation Changes in Plotly.py 6.1
order: 41
order: 42
page_type: u-guide
permalink: python/static-image-generation-changes/
thumbnail: thumbnail/static-image-export.png
Expand Down
2 changes: 1 addition & 1 deletion doc/python/styling-plotly-express.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jupyter:
language: python
layout: base
name: Styling Plotly Express Figures
order: 31
order: 32
page_type: u-guide
permalink: python/styling-plotly-express/
thumbnail: thumbnail/plotly-express.png
Expand Down
Loading