|
5 | 5 | text_representation:
|
6 | 6 | extension: .md
|
7 | 7 | format_name: markdown
|
8 |
| - format_version: '1.1' |
9 |
| - jupytext_version: 1.2.1 |
| 8 | + format_version: '1.2' |
| 9 | + jupytext_version: 1.3.2 |
10 | 10 | kernelspec:
|
11 | 11 | display_name: Python 3
|
12 | 12 | language: python
|
@@ -638,6 +638,34 @@ fig.update_layout(
|
638 | 638 | fig.show()
|
639 | 639 | ```
|
640 | 640 |
|
| 641 | +#### Adding Shapes to Subplots |
| 642 | + |
| 643 | +```python |
| 644 | +import plotly.graph_objects as go |
| 645 | +from plotly.subplots import make_subplots |
| 646 | + |
| 647 | +# Create Subplots |
| 648 | +fig = make_subplots(rows=2, cols=2, start_cell='bottom-left') |
| 649 | + |
| 650 | +fig.add_trace(go.Scatter(x=[2, 6], y=[1,1]), row=1, col=1) |
| 651 | +fig.add_trace(go.Bar(x=[1,2,3], y=[4,5,6]), row=1, col=2) |
| 652 | +fig.add_trace(go.Scatter(x=[10,20], y=[40,50]), row=2, col=1) |
| 653 | +fig.add_trace(go.Bar(x=[11,13,15], y=[8,11,20]), row=2, col=2) |
| 654 | + |
| 655 | +# Add shapes |
| 656 | +fig.update_layout( |
| 657 | + shapes=[ |
| 658 | + dict(type="line", xref="x1", yref="y1", |
| 659 | + x0=3, y0=0.5, x1=5, y1=0.8), |
| 660 | + dict(type="rect", xref="x2", yref='y2', |
| 661 | + x0=4, y0=2, x1=5, y1=6), |
| 662 | + dict(type="rect", xref="x3", yref="y3", |
| 663 | + x0=10, y0=20, x1=15, y1=30), |
| 664 | + dict(type="circle", xref="x4", yref="y4", |
| 665 | + x0=5, y0=12, x1=10, y1=18)]) |
| 666 | +fig.show() |
| 667 | +``` |
| 668 | + |
641 | 669 | #### SVG Paths
|
642 | 670 |
|
643 | 671 | ```python
|
|
0 commit comments