Skip to content

Commit df66a2c

Browse files
big batch of layout.geo docs (#2109)
* big batch of layout.geo docs * second pass on geo docs * adding token to gitignore * PR feedback
1 parent e031443 commit df66a2c

14 files changed

+588
-177
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,4 @@ plotly/tests/test_orca/images/*/tmp
4444
temp-plot.html
4545
.vscode
4646
doc/python/.ipynb_checkpoints
47+
doc/python/.mapbox_token

doc/python/axes.md

+16-19
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ jupyter:
55
text_representation:
66
extension: .md
77
format_name: markdown
8-
format_version: '1.2'
8+
format_version: "1.2"
99
jupytext_version: 1.3.0
1010
kernelspec:
1111
display_name: Python 3
@@ -22,7 +22,8 @@ jupyter:
2222
pygments_lexer: ipython3
2323
version: 3.7.3
2424
plotly:
25-
description: How to adjust axes properties in python. Includes examples of linear
25+
description:
26+
How to adjust axes properties in python. Includes examples of linear
2627
and logarithmic axes, axes titles, styling and coloring axes and grid lines,
2728
and more.
2829
display_as: file_settings
@@ -34,23 +35,24 @@ jupyter:
3435
thumbnail: thumbnail/axes.png
3536
---
3637

37-
This tutorial explain how to set the properties of Cartesian axes, namely [`go.layout.XAxis`](/python/reference/#layout-xaxis) and [`go.layout.YAxis`](python/reference/#layout-xaxis). Other kinds of axes are described in other tutorials:
38+
This tutorial explain how to set the properties of 2-dimensional Cartesian axes, namely [`go.layout.XAxis`](/python/reference/#layout-xaxis) and [`go.layout.YAxis`](python/reference/#layout-xaxis). Other kinds of axes are described in other tutorials:
39+
3840
- [3D axes](/python/3d-axes) The axis object is [`go.layout.Scene`](/python/reference/#layout-scene)
3941
- [Polar axes](/python/polar-chart/). The axis object is [`go.layout.Polar`](/python/reference/#layout-polar)
4042
- [Ternary axes](/python/ternary-plots). The axis object is [`go.layout.Ternary`](/python/reference/#layout-ternary)
41-
- For Geo axes, see [this choropleth example](/python/choropleth-maps/#world-choropleth-map). The axis object is [`go.layout.Geo`](/python/reference/#layout-geo)
42-
- For Mapbox axes, see the different mapbox tutorials in the [Maps page](/python/maps/). The axis object is [`go.layout.Mapbox`](/python/reference/#layout-mapbox)
43-
- Color axes are described in the [color scales tutorial](/python/colorscales/).
43+
- [Geo axes](/python/map-configuration/). The axis object is [`go.layout.Geo`](/python/reference/#layout-geo)
44+
- [Mapbox axes](/python/mapbox-layers/). The axis object is [`go.layout.Mapbox`](/python/reference/#layout-mapbox)
45+
- [Color axes](/python/colorscales/). The axis object is [`go.layout.Coloraxis`](/python/reference/#layout-coloraxis).
4446

4547
**See also** the tutorials on [subplots](/python/subplots) and [multiple axes](/python/multiple-axes/).
4648

47-
The different types of Cartesian axes are
49+
The different types of Cartesian axes are
50+
4851
- 'linear'
4952
- 'log' (see the [example below](#logarithmic-axes))
5053
- 'date' (see the [tutorial on timeseries](/python/time-series/))
5154
- 'category' (see for example [Bar Charts](/python/bar-charts/))
52-
- 'multicategory' (see the [example below](#subcategory-(multicategory)-axes) ))
53-
55+
- 'multicategory' (see the [example below](<#subcategory-(multicategory)-axes>))
5456

5557
#### Logarithmic Axes
5658

@@ -92,7 +94,7 @@ fig.show()
9294

9395
### Forcing an axis to be categorical
9496

95-
If you pass string values for the `x` or `y` parameter, plotly will automatically set the corresponding axis type to `category`, with the exception of string of numbers, in which case the axis is linear. It is however possible to force the axis type by setting explicitely `xaxis_type` to be `category`.
97+
If you pass string values for the `x` or `y` parameter, plotly will automatically set the corresponding axis type to `category`, with the exception of string of numbers, in which case the axis is linear. It is however possible to force the axis type by setting explicitely `xaxis_type` to be `category`.
9698

9799
```python
98100
import plotly.express as px
@@ -150,17 +152,16 @@ fig.update_layout(title_text="Multi-category axis",)
150152
fig.show()
151153
```
152154

153-
154155
#### Toggling Axes Lines, Ticks, Labels, and Autorange
155156

156-
The different groups of Cartesian axes properties are
157+
The different groups of Cartesian axes properties are
158+
157159
- tick values (locations of tick marks) and tick labels. Tick labels are placed at tick values.
158160
- lines: grid lines (passing through tick values), axis lines, zero lines
159161
- title of the axis
160162
- range of the axis
161163
- domain of the axis
162164

163-
164165
#### Tick Placement, Color, and Style
165166

166167
##### Toggling axis tick marks
@@ -169,7 +170,6 @@ Axis tick marks are disabled by default for the default `plotly` theme, but they
169170

170171
Here is an example of turning on inside x-axis and y-axis ticks in a faceted figure created using Plotly Express. Note how the `col` argument to `update_yaxes` is used to only turn on the y-axis ticks for the left-most subplot.
171172

172-
173173
```python
174174
import plotly.express as px
175175
df = px.data.iris()
@@ -265,7 +265,6 @@ fig.update_yaxes(showticklabels=False)
265265
fig.show()
266266
```
267267

268-
269268
##### Set axis label rotation and font
270269

271270
The orientation of the axis tick mark labels is configured using the `tickangle` axis property. The value of `tickangle` is the angle of rotation, in the clockwise direction, of the labels from vertical in units of degrees. The font family, size, and color for the tick labels are stored under the `tickfont` axis property.
@@ -324,7 +323,6 @@ fig.update_layout(title_text="Apple Stock Price")
324323
fig.show()
325324
```
326325

327-
328326
### Axis lines: grid and zerolines
329327

330328
##### Toggling Axis grid lines
@@ -534,7 +532,6 @@ fig.update_yaxes(range=[3, 9])
534532
fig.show()
535533
```
536534

537-
538535
### Fixed Ratio Axes
539536

540537
The `scaleanchor` and `scaleratio` axis properties can be used to force a fixed ratio of pixels per unit between two axes.
@@ -593,7 +590,7 @@ fig.show()
593590

594591
##### Decreasing the domain spanned by an axis
595592

596-
In the example below, the x and y axis are anchored together, and the range of the `xaxis` is set manually. By default, plotly extends the range of the axis (overriding the `range` parameter) to fit in the figure `domain`. You can restrict the `domain` to force the axis to span only the set range, by setting `constrain='domain'` as below.
593+
In the example below, the x and y axis are anchored together, and the range of the `xaxis` is set manually. By default, plotly extends the range of the axis (overriding the `range` parameter) to fit in the figure `domain`. You can restrict the `domain` to force the axis to span only the set range, by setting `constrain='domain'` as below.
597594

598595
```python
599596
import plotly.graph_objects as go
@@ -687,7 +684,7 @@ fig.show()
687684

688685
### Axis range for log axis type
689686

690-
If you are using a `log` type of axis and you want to set the range of the axis, you have to give the `log10` value of the bounds when using `fig.update_xaxes` or `fig.update_layout`. However, with `plotly.express` functions you pass directly the values of the range bounds (`plotly.express` then computes the appropriate values to pass to the figure layout).
687+
If you are using a `log` type of axis and you want to set the range of the axis, you have to give the `log10` value of the bounds when using `fig.update_xaxes` or `fig.update_layout`. However, with `plotly.express` functions you pass directly the values of the range bounds (`plotly.express` then computes the appropriate values to pass to the figure layout).
691688

692689
```python
693690
import plotly.express as px

doc/python/bubble-maps.md

+4
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ jupyter:
3333
thumbnail: thumbnail/bubble-map.jpg
3434
---
3535

36+
#### Base Map Configuration
37+
38+
Plotly figures made with `px.scatter_geo`, `px.line_geo` or `px.choropleth` functions or containing `go.Choropleth` or `go.Scattergeo` graph objects have a `go.layout.Geo` object which can be used to [control the appearance of the base map](/python/map-configuration/) onto which data is plotted.
39+
3640
### Bubble map with Plotly Express
3741

3842
[Plotly Express](/python/plotly-express/) is the easy-to-use, high-level interface to Plotly, which [operates on "tidy" data](/python/px-arguments/). With `px.scatter_geo`, each line of the dataframe is represented as a marker point. The column set as the `size` argument gives the size of markers.

0 commit comments

Comments
 (0)