Skip to content

Commit 51f7011

Browse files
author
mahdis-z
committed
minor modification
1 parent fb7438f commit 51f7011

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

doc/python/shapes.md

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,26 @@ jupyter:
3333
thumbnail: thumbnail/shape.jpg
3434
---
3535

36+
### Filled Area Chart
37+
38+
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.
39+
40+
```python
41+
import plotly.graph_objects as go
42+
43+
fig = go.Figure(go.Scatter(x=[0,1,2], y=[0,2,0], fill="toself"))
44+
fig.show()
45+
```
46+
47+
You can have more shapes either by adding [more traces](https://plot.ly/python/filled-area-plots/) or interrupting the series with `None`.
48+
49+
```python
50+
import plotly.graph_objects as go
51+
52+
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"))
53+
fig.show()
54+
```
55+
3656
#### Vertical and Horizontal Lines Positioned Relative to the Axes
3757

3858
```python
@@ -682,25 +702,5 @@ fig.update_layout(
682702
fig.show()
683703
```
684704

685-
### Filled Area Chart
686-
687-
So far we saw [layout.shapes](https://plot.ly/python/reference/#layout-shapes-items-shape-type) defines the shape type to be drawn, which can be rectangle, circle, line, or path (a custom SVG path). You also can set an area to be filled with a solid color by defining [Scatter.fill="toself"](https://plot.ly/python/reference/#scatter-fill) that connects the endpoints of the trace into a closed shape.
688-
689-
```python
690-
import plotly.graph_objects as go
691-
692-
fig = go.Figure(go.Scatter(x=[0,1,2], y=[0,2,0], fill="toself"))
693-
fig.show()
694-
```
695-
696-
You can have more shapes either by adding [more traces](https://plot.ly/python/filled-area-plots/) or interupting the series with `None`.
697-
698-
```python
699-
import plotly.graph_objects as go
700-
701-
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"))
702-
fig.show()
703-
```
704-
705705
### Reference
706706
See https://plot.ly/python/reference/#layout-shapes for more information and chart attribute options!

0 commit comments

Comments
 (0)