Skip to content

Commit 4911830

Browse files
committed
Add zero line layer example
1 parent ae85438 commit 4911830

File tree

1 file changed

+34
-2
lines changed

1 file changed

+34
-2
lines changed

doc/python/axes.md

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ jupyter:
66
extension: .md
77
format_name: markdown
88
format_version: '1.3'
9-
jupytext_version: 1.16.3
9+
jupytext_version: 1.17.2
1010
kernelspec:
1111
display_name: Python 3 (ipykernel)
1212
language: python
@@ -20,7 +20,7 @@ jupyter:
2020
name: python
2121
nbconvert_exporter: python
2222
pygments_lexer: ipython3
23-
version: 3.10.14
23+
version: 3.9.0
2424
plotly:
2525
description: How to adjust axes properties in Python - axes titles, styling and
2626
coloring axes and grid lines, ticks, tick labels and more.
@@ -619,6 +619,38 @@ fig.update_yaxes(zeroline=True, zerolinewidth=2, zerolinecolor='LightPink')
619619
fig.show()
620620
```
621621

622+
##### Controlling zero line layer
623+
624+
*New in 6.3*
625+
626+
By default, zero lines are displayed below traces. Set `zerolinelayer="above traces"` on an axis to display its zero line above traces:
627+
628+
```python
629+
import plotly.graph_objects as go
630+
631+
x = ['A', 'B', 'C', 'D', 'A']
632+
y = [2, 0, 4, -3, 2]
633+
634+
fig = go.Figure(
635+
data=[
636+
go.Scatter(
637+
x=x,
638+
y=y,
639+
fill='toself',
640+
mode='none',
641+
fillcolor='lightpink'
642+
)
643+
],
644+
layout=dict(
645+
yaxis=dict(
646+
zerolinelayer="above traces" # Change to "below traces" to see the difference
647+
),
648+
)
649+
)
650+
651+
fig.show()
652+
```
653+
622654
#### Setting the Range of Axes Manually
623655

624656
The visible x and y axis range can be configured manually by setting the `range` axis property to a list of two values, the lower and upper bound.

0 commit comments

Comments
 (0)