Skip to content

Commit fb7438f

Browse files
author
mahdis-z
committed
filled area
1 parent ef46749 commit fb7438f

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

doc/python/shapes.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ jupyter:
66
extension: .md
77
format_name: markdown
88
format_version: '1.1'
9-
jupytext_version: 1.1.1
9+
jupytext_version: 1.2.1
1010
kernelspec:
1111
display_name: Python 3
1212
language: python
@@ -682,5 +682,25 @@ fig.update_layout(
682682
fig.show()
683683
```
684684

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+
685705
### Reference
686706
See https://plot.ly/python/reference/#layout-shapes for more information and chart attribute options!

0 commit comments

Comments
 (0)