From 162dab5b065fb795445cbcb643e85a7878193f8c Mon Sep 17 00:00:00 2001 From: Liam Connors Date: Mon, 4 Apr 2022 11:45:04 -0400 Subject: [PATCH] Update axes.md --- doc/python/axes.md | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/doc/python/axes.md b/doc/python/axes.md index 86c7d8ed4e2..f971c2e4e8c 100644 --- a/doc/python/axes.md +++ b/doc/python/axes.md @@ -5,10 +5,10 @@ jupyter: text_representation: extension: .md format_name: markdown - format_version: '1.2' - jupytext_version: 1.4.2 + format_version: '1.3' + jupytext_version: 1.13.7 kernelspec: - display_name: Python 3 + display_name: Python 3 (ipykernel) language: python name: python3 language_info: @@ -20,7 +20,7 @@ jupyter: name: python nbconvert_exporter: python pygments_lexer: ipython3 - version: 3.7.7 + version: 3.9.0 plotly: description: How to adjust axes properties in Python - axes titles, styling and coloring axes and grid lines, ticks, tick labels and more. @@ -291,6 +291,20 @@ fig.update_yaxes(ticks="outside", tickwidth=2, tickcolor='crimson', ticklen=10, fig.show() ``` +##### Step for tick labels + +You can set a step for tick labels with `ticklabelstep`. In this example, we hide labels between every `2` ticks on the y axes. Similarly, this can be used with `fig.update_xaxes` for x axes: `fig.update_xaxes(ticklabelstep=2)`. + +```python +import plotly.express as px +df = px.data.iris() + +fig = px.scatter(df, x="sepal_width", y="sepal_length", facet_col="species") +fig.update_yaxes(ticklabelstep=2) + +fig.show() +``` + ##### Toggling axis labels The axis tick mark labels can be disabled by setting the `showticklabels` axis property to `False`.