-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
filled area #2089
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
filled area #2089
Conversation
doc/python/shapes.md
Outdated
@@ -682,5 +682,25 @@ fig.update_layout( | |||
fig.show() | |||
``` | |||
|
|||
### Filled Area Chart |
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.
I would move this to the very top, with a little intro saying "there are two ways to draw filled shapes: scatter traces and layout.shapes" with a note that layout.shapes is mostly useful for cartesian 2d subplots, but you can use e.g. scatterpolar and scattergeo and scattermapbox to draw filled shapes on any kind of subplots.
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.
You can add a link to the scatterpolar page where we have filled shapes, and to the "filled shapes on mapbox" page that you wrote last year?
doc/python/shapes.md
Outdated
```python | ||
import plotly.graph_objects as go | ||
|
||
fig = go.Figure(go.Scatter(x=[0,1,2], y=[0,2,0], fill="toself")) |
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.
can you add a final point that's the same as the initial point, so the line goes all the way around?
doc/python/shapes.md
Outdated
```python | ||
import plotly.graph_objects as go | ||
|
||
fig = go.Figure(go.Scatter(x=[0,1,2,None,3,3,5,5], y=[0,2,0,None,0.5,1.5,1.5,0.5], fill="toself")) |
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.
can you add a final point to each shape that's the same as the initial point, so the line goes all the way around?
doc/python/shapes.md
Outdated
@@ -33,6 +33,26 @@ jupyter: | |||
thumbnail: thumbnail/shape.jpg | |||
--- | |||
|
|||
### Filled Area Chart | |||
|
|||
There are two ways to draw filled shapes: scatter traces and [layout.shapes](https://plot.ly/python/reference/#layout-shapes-items-shape-type) which is mostly useful for the 2d subplots, and defines the shape type to be drawn, and can be rectangle, circle, line, or path (a custom SVG path). You also can use [scatterpolar](https://plot.ly/python/polar-chart/#categorical-polar-chart), scattergeo, [scattermapbox](https://plot.ly/python/filled-area-on-mapbox/#filled-scattermapbox-trace) to draw filled shapes on any kind of subplots. To set an area to be filled with a solid color, you need to define [Scatter.fill="toself"](https://plot.ly/python/reference/#scatter-fill) that connects the endpoints of the trace into a closed shape. |
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.
Maybe add a sentence saying that if mode
contains "lines"
(which is the default) then you'll likely want to repeat the first point of a shape at the end of the sequence, so the line goes all the way around.
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.
Yeah to have a closed shape, all right!
💃 when the build is green |
closes #2080