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
#### Setting only a Lower or Upper Bound for Range
563
+
564
+
*New in 5.16*
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.16*
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.
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).
@@ -717,25 +768,6 @@ fig.update_yaxes(type="log")
717
768
fig.show()
718
769
```
719
770
720
-
#### <code>nonnegative</code>, <code>tozero</code>, and <code>normal</code> Rangemode
721
-
722
-
The axis auto-range calculation logic can be configured using the `rangemode` axis parameter.
723
-
724
-
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.
725
-
726
-
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
809
+
810
+
When you don't specify a range, autorange is used. It's also used for bounds set to `None` when providing a `range`.
811
+
812
+
The axis auto-range calculation logic can be configured using the `rangemode` axis parameter.
813
+
814
+
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.
815
+
816
+
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.
834
+
835
+
##### Specifying Minimum and Maximum Allowed Values
836
+
837
+
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