You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/python/shapes.md
+61-2Lines changed: 61 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ jupyter:
6
6
extension: .md
7
7
format_name: markdown
8
8
format_version: '1.3'
9
-
jupytext_version: 1.16.3
9
+
jupytext_version: 1.19.1
10
10
kernelspec:
11
11
display_name: Python 3 (ipykernel)
12
12
language: python
@@ -20,7 +20,7 @@ jupyter:
20
20
name: python
21
21
nbconvert_exporter: python
22
22
pygments_lexer: ipython3
23
-
version: 3.10.14
23
+
version: 3.14.3
24
24
plotly:
25
25
description: How to make SVG shapes in python. Examples of lines, circle, rectangle,
26
26
and path.
@@ -488,6 +488,65 @@ fig.update_layout(
488
488
fig.show()
489
489
```
490
490
491
+
#### Shapes Spanning Subplots
492
+
493
+
*New in 6.6*
494
+
495
+
You can create shapes that span multiple subplots by passing an array of axis references to `xref` and `yref`. Each element in the array specifies which axis the corresponding coordinate refers to. For example, in the following code, with `xref=["x", "x2"]`, `x0` refers to the `x` axis and `x1` refers to the `x2` axis.
xref=["x", "x2"], # x0 uses the x-axis from subplot 1 ("x"), while x1 uses the x-axis from subplot 2 ("x2")
509
+
yref=["y", "y2"], # y0 uses the y-axis from subplot 1 ("y"), while y1 uses the y-axis from subplot 2 ("y2")
510
+
x0=2, y0=4.5,
511
+
x1=3, y1=5.5,
512
+
fillcolor="rgba(255, 0, 0, 0.2)",
513
+
line=dict(color="red", width=2),
514
+
)
515
+
516
+
fig.show()
517
+
```
518
+
519
+
For `path` shapes, the array must have one entry for each coordinate in the path string. Each coordinate in the path maps to the corresponding element in the `xref`/`yref` array, in order.
0 commit comments