Skip to content

Commit c8d93bf

Browse files
tweaks to minor-ticks docs
1 parent db61823 commit c8d93bf

File tree

3 files changed

+23
-16
lines changed

3 files changed

+23
-16
lines changed

doc/python/axes.md

+5-8
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jupyter:
2020
name: python
2121
nbconvert_exporter: python
2222
pygments_lexer: ipython3
23-
version: 3.9.0
23+
version: 3.9.7
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.
@@ -386,12 +386,10 @@ fig.show()
386386

387387
_new in 5.8_
388388

389-
You can position and style minor ticks on a Cartesian axis using `minor`. This takes a `dict` of properties to apply to minor ticks. Available properties include: `tickmode`, `tickvals`, `tickcolor`, `ticklen`, `tickwidth`, `dtick`, `tick0`, `nticks`, `ticks`, `showgrid`, `gridcolor`, `griddash`, and `gridwidth`.
389+
You can position and style minor ticks on a Cartesian axis using the `minor` attribute. This takes a `dict` of properties to apply to minor ticks. See the [figure reference](https://plotly.com/python/reference/layout/xaxis/#layout-xaxis-minor) for full details on the accepted keys in this dict.
390390

391391
In the following example, we add minor ticks to the x-axis and then to the y-axis. For the y-axis we add ticks on the inside: `ticks="inside"`. On the x-axis we've specified some additional properties to style the minor ticks, setting the length of the ticks with `ticklen` and the color with `tickcolor`. We've also turned on grid lines for the x-axis minor ticks using `showgrid`.
392392

393-
Note: Minor ticks and grid lines are not currently supported on color bars, ternary plots, polar charts, geo plots, or on multi-categorical, or 3D axes.
394-
395393
```python
396394
import plotly.express as px
397395
import pandas as pd
@@ -401,7 +399,7 @@ fig = px.scatter(df, x="total_bill", y="tip", color="sex")
401399

402400

403401
fig.update_xaxes(minor=dict(ticklen=6, tickcolor="black", showgrid=True))
404-
fig.update_yaxes(minor=dict(ticks="inside"))
402+
fig.update_yaxes(minor_ticks="inside")
405403

406404
fig.show()
407405
```
@@ -492,15 +490,14 @@ fig.show()
492490

493491
_new in 5.8_
494492

495-
By default grid lines are `solid`. Set the `griddash` property to change this style. In this example we display the x-axis grid lines as `dot`. It can also be set to `dash`, `longdash`, `dashdot`, or `longdashdot`.
493+
By default grid lines are `solid`. Set the `griddash` property to change this style. In this example we display the x-axis grid lines as `dash` and the minor grid lines as `dot`. Other allowable values are `longdash`, `dashdot`, or `longdashdot`.
496494

497495
```python
498496
import plotly.express as px
499497
df = px.data.iris()
500498

501499
fig = px.scatter(df, x="sepal_width", y="sepal_length", facet_col="species")
502-
fig.update_xaxes(showgrid=True, gridwidth=1, gridcolor='LightPink', griddash='dot')
503-
fig.update_yaxes(showgrid=True, gridwidth=1, gridcolor='LightPink')
500+
fig.update_xaxes(gridcolor='black', griddash='dash', minor_griddash="dot")
504501

505502
fig.show()
506503
```

doc/python/log-plot.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jupyter:
2020
name: python
2121
nbconvert_exporter: python
2222
pygments_lexer: ipython3
23-
version: 3.9.0
23+
version: 3.9.7
2424
plotly:
2525
description: How to make Log plots in Python with Plotly.
2626
display_as: scientific
@@ -64,7 +64,7 @@ fig.show()
6464

6565
_new in 5.8_
6666

67-
You can position and style minor ticks using `minor`. This takes a `dict` of properties to apply to minor ticks. Available properties include: `tickmode`, `tickvals`, `tickcolor`, `ticklen`, `tickwidth`, `dtick`, `tick0`, `nticks`, `ticks`, `showgrid`, `gridcolor`, `griddash`, and `gridwidth`.
67+
You can position and style minor ticks using `minor`. This takes a `dict` of properties to apply to minor ticks. See the [figure reference](https://plotly.com/python/reference/layout/xaxis/#layout-xaxis-minor) for full details on the accepted keys in this dict.
6868

6969
In this example we set the tick length with `ticklen`, add the ticks on the inside with `ticks="inside"`, and turn grid lines on with `howgrid=True`.
7070

@@ -75,7 +75,7 @@ df = px.data.gapminder().query("year == 2007")
7575
fig = px.scatter(df, x="gdpPercap", y="lifeExp", hover_name="country",
7676
log_x=True, range_x=[1,100000], range_y=[0,100])
7777

78-
fig.update_xaxes(minor=dict(ticks="inside", ticklen=6, showgrid=True))# {"ticks": "inside", "ticklen": 6, "showgrid": True})
78+
fig.update_xaxes(minor=dict(ticks="inside", ticklen=6, showgrid=True))
7979

8080
fig.show()
8181
```

doc/python/time-series.md

+15-5
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jupyter:
2020
name: python
2121
nbconvert_exporter: python
2222
pygments_lexer: ipython3
23-
version: 3.9.0
23+
version: 3.9.7
2424
plotly:
2525
description: How to plot date and time in python.
2626
display_as: financial
@@ -139,9 +139,9 @@ fig.show()
139139

140140
_new in 5.8_
141141

142-
You can add minor ticks to an axis with `minor`. This takes a `dict` of properties to apply to minor ticks. Available properties include: `tickmode`, `tickvals`, `tickcolor`, `ticklen`, `tickwidth`, `dtick`, `tick0`, `nticks`, `ticks`, `showgrid`, `gridcolor`, `griddash`, and `gridwidth`.
142+
You can add minor ticks to an axis with `minor`. This takes a `dict` of properties to apply to minor ticks. See the [figure reference](https://plotly.com/python/reference/layout/xaxis/#layout-xaxis-minor) for full details on the accepted keys in this dict.
143143

144-
In this example, we've added minor ticks to the inside of the x-axis and turned on grid lines.
144+
In this example, we've added minor ticks to the inside of the x-axis and turned on minor grid lines.
145145

146146
```python
147147
import pandas as pd
@@ -159,7 +159,7 @@ fig.show()
159159

160160
_new in 5.8_
161161

162-
You can set `dtick` on `minor` to control the spacing for minor ticks and grid lines. In the following example, by setting `dtick=7*24*3.6e6` (the number of milliseconds in a week) and setting `tick0="2016-07-04"` (the first Monday in our data), a minor tick and grid line is displayed for the start of each week. When zoomed out, we can see where each month and week begins and ends.
162+
You can set `dtick` on `minor` to control the spacing for minor ticks and grid lines. In the following example, by setting `dtick=7*24*60*60*1000` (the number of milliseconds in a week) and setting `tick0="2016-07-043"` (the first Sunday in our data), a minor tick and grid line is displayed for the start of each week. When zoomed out, we can see where each month and week begins and ends.
163163

164164
```python
165165
import pandas as pd
@@ -169,7 +169,17 @@ df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/finan
169169
df = df.loc[(df["Date"] >= "2016-07-01") & (df["Date"] <= "2016-12-01")]
170170

171171
fig = px.line(df, x='Date', y='AAPL.High')
172-
fig.update_xaxes(ticks= "outside", ticklabelmode= "period", tickcolor= "black", tickwidth=2, ticklen=10, minor=dict(ticks="outside", dtick=7*24*3.6e6, tick0="2016-07-04", griddash='dot', gridcolor='pink'))
172+
fig.update_xaxes(ticks= "outside",
173+
ticklabelmode= "period",
174+
tickcolor= "black",
175+
ticklen=10,
176+
minor=dict(
177+
ticklen=4,
178+
dtick=7*24*60*60*1000,
179+
tick0="2016-07-03",
180+
griddash='dot',
181+
gridcolor='white')
182+
)
173183

174184
fig.show()
175185
```

0 commit comments

Comments
 (0)