-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Docs for 6.6 #5516
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
LiamConnors
wants to merge
6
commits into
main
Choose a base branch
from
new-charts
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+165
−6
Draft
Docs for 6.6 #5516
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
9dc893d
Update shapes.md
LiamConnors e9fbfd8
Update marker-style.md
LiamConnors 8ce515f
Update marker-style.md
LiamConnors bc93d27
Merge branch 'main' into new-charts
LiamConnors ea9fe93
Update legend.md
LiamConnors 0b62296
Merge branch 'new-charts' of https://github.com/plotly/plotly.py into…
LiamConnors File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -6,7 +6,7 @@ jupyter: | |||||
| extension: .md | ||||||
| format_name: markdown | ||||||
| format_version: '1.3' | ||||||
| jupytext_version: 1.16.3 | ||||||
| jupytext_version: 1.19.1 | ||||||
| kernelspec: | ||||||
| display_name: Python 3 (ipykernel) | ||||||
| language: python | ||||||
|
|
@@ -20,7 +20,7 @@ jupyter: | |||||
| name: python | ||||||
| nbconvert_exporter: python | ||||||
| pygments_lexer: ipython3 | ||||||
| version: 3.10.14 | ||||||
| version: 3.14.3 | ||||||
| plotly: | ||||||
| description: How to make SVG shapes in python. Examples of lines, circle, rectangle, | ||||||
| and path. | ||||||
|
|
@@ -488,6 +488,65 @@ fig.update_layout( | |||||
| fig.show() | ||||||
| ``` | ||||||
|
|
||||||
| #### Shapes Spanning Subplots | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
does that sound better? |
||||||
|
|
||||||
| *New in 6.6* | ||||||
|
|
||||||
| 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. | ||||||
|
|
||||||
| ```python | ||||||
| import plotly.graph_objects as go | ||||||
| from plotly.subplots import make_subplots | ||||||
|
|
||||||
| fig = make_subplots(rows=1, cols=2) | ||||||
|
|
||||||
| fig.add_trace(go.Scatter(x=[1, 2, 3], y=[4, 5, 6], mode="markers", marker=dict(size=10)), row=1, col=1) | ||||||
| fig.add_trace(go.Scatter(x=[1, 2, 3], y=[6, 5, 4], mode="markers", marker=dict(size=10)), row=1, col=2) | ||||||
|
|
||||||
| fig.add_shape( | ||||||
| type="rect", | ||||||
| xref=["x", "x2"], # x0 uses the x-axis from subplot 1 ("x"), while x1 uses the x-axis from subplot 2 ("x2") | ||||||
| yref=["y", "y2"], # y0 uses the y-axis from subplot 1 ("y"), while y1 uses the y-axis from subplot 2 ("y2") | ||||||
| x0=2, y0=4.5, | ||||||
| x1=3, y1=5.5, | ||||||
| fillcolor="rgba(255, 0, 0, 0.2)", | ||||||
| line=dict(color="red", width=2), | ||||||
| ) | ||||||
|
|
||||||
| fig.show() | ||||||
| ``` | ||||||
|
|
||||||
| 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. | ||||||
|
|
||||||
| ```python | ||||||
| import plotly.graph_objects as go | ||||||
| from plotly.subplots import make_subplots | ||||||
|
|
||||||
| fig = make_subplots(rows=1, cols=2) | ||||||
|
|
||||||
| fig.add_trace(go.Scatter(x=[1, 2, 3], y=[1, 2, 3], mode="markers"), row=1, col=1) | ||||||
| fig.add_trace(go.Scatter(x=[1, 2, 3], y=[3, 2, 1], mode="markers"), row=1, col=2) | ||||||
|
|
||||||
| # Chevron shape spanning both subplots | ||||||
| # Path coordinates map to axis refs in order: | ||||||
| # M 2.5 1.5 -> xref[0]=x, yref[0]=y (start in subplot 1) | ||||||
| # L 1.5 2 -> xref[1]=x2, yref[1]=y2 (tip in subplot 2) | ||||||
| # L 2.5 2.5 -> xref[2]=x, yref[2]=y (end in subplot 1) | ||||||
|
|
||||||
| fig.add_shape( | ||||||
| type="path", | ||||||
| path="M 2.5 1.5 L 1.5 2 L 2.5 2.5", | ||||||
| xref=["x", "x2", "x"], | ||||||
| yref=["y", "y2", "y"], | ||||||
| line=dict(color="purple", width=3), | ||||||
| ) | ||||||
|
|
||||||
| fig.show() | ||||||
| ``` | ||||||
|
|
||||||
| **Note:** When using arrays with `xref` and `yref`, `xsizemode="pixel"` and `ysizemode="pixel"` are not supported. | ||||||
|
|
||||||
|
|
||||||
| #### Adding the Same Shapes to Multiple Subplots | ||||||
| The same shape can be added to multiple facets by using the `'all'` | ||||||
| keyword in the `row` and `col` arguments. For example | ||||||
|
|
||||||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of saying "pie-like trace", can we just list the trace types which are not supported? It's not obvious to me which trace types count as pie-like.