Skip to content

modifications base on 4.3 defaults #201

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 18, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 28 additions & 3 deletions python/axes.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jupyter:
extension: .md
format_name: markdown
format_version: '1.1'
jupytext_version: 1.1.6
jupytext_version: 1.2.1
kernelspec:
display_name: Python 3
language: python
Expand All @@ -23,8 +23,8 @@ jupyter:
version: 3.7.3
plotly:
description: How to adjust axes properties in python. Includes examples of linear
and logarithmic axes, axes titles, styling and coloring axes and grid lines, and
more.
and logarithmic axes, axes titles, styling and coloring axes and grid lines,
and more.
display_as: file_settings
language: python
layout: base
Expand Down Expand Up @@ -222,6 +222,31 @@ fig.update_yaxes(title_text='Value A')
fig.show()
```

### Set axis title position

This example sets `standoff` attribute to cartesian axes to determine the distance between the tick labels and the axis title. Note that the axis title position is always constrained within the margins, so the actual standoff distance is always less than the set or default value. By default [automargin](https://plot.ly/python/setting-graph-size/#automatically-adjust-margins) is `True` in Plotly template for the cartesian axis, so the margins will be pushed to fit the axis title at given standoff distance.

```python
import plotly.graph_objects as go

fig = go.Figure(go.Scatter(
mode = "lines+markers",
y = [4, 1, 3],
x = ["December", "January", "February"]))

fig.update_layout(
xaxis = go.layout.XAxis(
tickangle = 90,
title_text = "Month",
title_font = {"size": 20},
title_standoff = 25),
yaxis = go.layout.YAxis(
title_text = "Temperature",
title_standoff = 25))

fig.show()
```

##### Set axis title font
Here is an example that configures the font family, size, and color for the axis titles in a figure created using Plotly Express.

Expand Down