You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Updated Plotly.js from version 2.25.2 to version 2.26.0. See the [plotly.js CHANGELOG](https://github.com/plotly/plotly.js/blob/master/CHANGELOG.md#2260----2023-08-24) for more information. These changes are reflected in the auto-generated `plotly.graph_objects` module. Notable changes include:
10
+
- Add "min", "max", "min reversed" and "max reversed" autorange options and handle partial ranges (i.e. one end being null), add `autorangeoptions` (`clipmin`, `clipmax`, `minallowed`, `maxallowed`, `include`) as well as `minallowed` and `maxallowed` to cartesian, gl3d and radial axes [[#6547](https://github.com/plotly/plotly.js/pull/6547)]
11
+
- Add [n]-sigma (std deviations) box plots as an alternative to quartiles [[#6697](https://github.com/plotly/plotly.js/issues/6697)], with thanks to @28raining for the contribution!
12
+
- Add "top left" & "top center" side options to legend title [[#6711](https://github.com/plotly/plotly.js/pull/6711)], with thanks to @28raining for the contribution!
13
+
- Add "false" option to `scaleanchor` to allow removing a constraint that is set by default [[#6712](https://github.com/plotly/plotly.js/pull/6712)], with thanks to @lvlte for the contribution!
14
+
9
15
10
16
### Fixed
11
17
- Fixed two issues with px.imshow: [[#4330](https://github.com/plotly/plotly.py/issues/4330)] when facet_col is an earlier dimension than animation_frame for xarrays and [[#4329](https://github.com/plotly/plotly.py/issues/4329)] when facet_col has string coordinates in xarrays [[#4331](https://github.com/plotly/plotly.py/pull/4331)]
Copy file name to clipboardExpand all lines: doc/python/3d-axes.md
+37-8
Original file line number
Diff line number
Diff line change
@@ -5,10 +5,10 @@ jupyter:
5
5
text_representation:
6
6
extension: .md
7
7
format_name: markdown
8
-
format_version: '1.1'
9
-
jupytext_version: 1.1.1
8
+
format_version: '1.3'
9
+
jupytext_version: 1.15.1
10
10
kernelspec:
11
-
display_name: Python 3
11
+
display_name: Python 3 (ipykernel)
12
12
language: python
13
13
name: python3
14
14
language_info:
@@ -20,7 +20,7 @@ jupyter:
20
20
name: python
21
21
nbconvert_exporter: python
22
22
pygments_lexer: ipython3
23
-
version: 3.7.3
23
+
version: 3.10.4
24
24
plotly:
25
25
description: How to format axes of 3d plots in Python with Plotly.
26
26
display_as: 3d_charts
@@ -41,6 +41,8 @@ set the range, title, ticks, color etc. of the axes.
41
41
42
42
For creating 3D charts, see [this page](https://plotly.com/python/3d-charts/).
43
43
44
+
Set `range` on an axis to manually configure a range for that axis. If you don't set `range`, it's automatically calculated. In this example, we set a `range` on `xaxis`, `yaxis`, and `zaxis`.
45
+
44
46
```python
45
47
import plotly.graph_objects as go
46
48
import numpy as np
@@ -66,6 +68,37 @@ fig.update_layout(
66
68
fig.show()
67
69
```
68
70
71
+
### Setting only a Lower or Upper Bound for Range
72
+
73
+
*New in 5.17*
74
+
75
+
You can also set just a lower or upper bound for `range`. In this case, autorange is used for the other bound. In this example, we apply autorange to the lower bound of the `yaxis` and the upper bound of `zaxis` by setting them to `None`.
#### Setting only a Lower or Upper Bound for Range
563
+
564
+
*New in 5.17*
565
+
566
+
You can also set just a lower or upper bound manually and have autorange applied to the other bound by setting it to `None`. In the following example, we set a an upper bound of 4.5 on the x axes, while specifying `None` for the lower bound, meaning it will use autorange. On the y axes, we set the lower bound, and use `None` for the upper bound, meaning that uses autorange.
#### Setting a Maximum and Minimum Allowed Axis Value
580
+
581
+
*New in 5.17*
582
+
583
+
When setting a range manually, you can also set a `maxallowed` or `minallowed` for an axis. With this set, you won't be able to pan further than the min or max allowed. In this example, we've set the minimum allowed on the x-axis to 1 and the maximum allowed on the y-axis to 10.
Pan/Zoom can be disabled for a given axis by setting `fixedrange` to `True`.
@@ -658,37 +693,6 @@ fig.update_yaxes(
658
693
)
659
694
660
695
661
-
fig.show()
662
-
```
663
-
664
-
### Fixed Ratio Axes with Compressed domain
665
-
666
-
If an axis needs to be compressed (either due to its own `scaleanchor` and `scaleratio` or those of the other axis), `constrain` determines how that happens: by increasing the "range" (default), or by decreasing the "domain".
667
-
668
-
```python
669
-
import plotly.graph_objects as go
670
-
671
-
fig = go.Figure()
672
-
673
-
fig.add_trace(go.Scatter(
674
-
x= [0,1,1,0,0,1,1,2,2,3,3,2,2,3],
675
-
y= [0,0,1,1,3,3,2,2,3,3,1,1,0,0]
676
-
))
677
-
678
-
fig.update_layout(
679
-
width=800,
680
-
height=500,
681
-
title="fixed-ratio axes with compressed axes"
682
-
)
683
-
fig.update_xaxes(
684
-
range=[-1,4], # sets the range of xaxis
685
-
constrain="domain", # meanwhile compresses the xaxis by decreasing its "domain"
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).
@@ -748,25 +782,6 @@ fig.update_yaxes(type="log")
748
782
fig.show()
749
783
```
750
784
751
-
#### <code>nonnegative</code>, <code>tozero</code>, and <code>normal</code> Rangemode
752
-
753
-
The axis auto-range calculation logic can be configured using the `rangemode` axis parameter.
754
-
755
-
If `rangemode` is `"normal"` (the default), the range is computed based on the min and max values of the input data. If `"tozero"`, the range will always include zero. If `"nonnegative"`, the range will not extend below zero, regardless of the input data.
756
-
757
-
Here is an example of configuring a faceted scatter plot created using Plotly Express to always include zero for both the x and y axes.
#### <code>nonnegative</code>, <code>tozero</code>, and <code>normal</code> Rangemode
823
+
824
+
When you don't specify a range, autorange is used. It's also used for bounds set to `None` when providing a `range`.
825
+
826
+
The axis auto-range calculation logic can be configured using the `rangemode` axis parameter.
827
+
828
+
If `rangemode` is `"normal"` (the default), the range is computed based on the min and max values of the input data. If `"tozero"`, the range will always include zero. If `"nonnegative"`, the range will not extend below zero, regardless of the input data.
829
+
830
+
Here is an example of configuring a faceted scatter plot created using Plotly Express to always include zero for both the x and y axes.
You can further configure how autorange is applied using `autorangeoptions` to specify maximum or minimum values or values to include.
848
+
849
+
##### Specifying Minimum and Maximum Allowed Values
850
+
851
+
Using `autorangeoptions.maxallowed`, you can specify an exact value to use as the autorange maximum. With `autorangeoptions.minallowed`, you can specify an exact value to use as the autorange minimum.
Use `autorangeoptions.include` to specify a value that should always be included within the calculated autorange. In this example, we specify that for the autorange calculated on the x-axis, 5 should be included.
See https://plotly.com/python/reference/layout/xaxis/ and https://plotly.com/python/reference/layout/yaxis/ for more information and chart attribute options!
0 commit comments