Skip to content

Commit f19bbf8

Browse files
committed
Add Minor Log Labels example
1 parent d9ec816 commit f19bbf8

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

doc/python/log-plot.md

Lines changed: 24 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.13.7
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.9.7
23+
version: 3.12.4
2424
plotly:
2525
description: How to make Log plots in Python with Plotly.
2626
display_as: scientific
@@ -80,6 +80,28 @@ fig.update_xaxes(minor=dict(ticks="inside", ticklen=6, showgrid=True))
8080
fig.show()
8181
```
8282

83+
#### Controlling Minor Log Labels
84+
85+
*New in 6.3*
86+
87+
By default, minor log labels use small digits, as shown in the previous example. You can control how minor log labels are displayed using the `minorloglabels` attribute. Set to `"complete"` to show complete digits, or `None` for no labels.
88+
89+
```python
90+
import plotly.express as px
91+
df = px.data.gapminder().query("year == 2007")
92+
93+
fig = px.scatter(
94+
df, x="gdpPercap",
95+
y="lifeExp",
96+
hover_name="country",
97+
log_x=True, range_x=[1,100000], range_y=[0,100])
98+
99+
fig.update_xaxes(minor=dict(ticks="inside", ticklen=6, showgrid=True),
100+
minorloglabels="complete")
101+
102+
fig.show()
103+
```
104+
83105
### Logarithmic Axes with Graph Objects
84106

85107
If Plotly Express does not provide a good starting point, it is also possible to use [the more generic `go.Figure` class from `plotly.graph_objects`](/python/graph-objects/).

0 commit comments

Comments
 (0)