Skip to content

Commit f9bd7da

Browse files
committedJul 26, 2022
Merge branch 'master' into release-5.10.0
2 parents 843b685 + a5f44e3 commit f9bd7da

File tree

11 files changed

+550
-59
lines changed

11 files changed

+550
-59
lines changed
 

‎CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
55
## [5.10.0] - 2022-07-26
66

77
### Updated
8-
- Updated Plotly.js to from version 2.12.1 to version 2.13.2. See the [plotly.js CHANGELOG](https://github.com/plotly/plotly.js/blob/master/CHANGELOG.md#2132----2022-07-21) for more information. Notable changes include:
8+
- Updated Plotly.js to from version 2.12.1 to version 2.13.3. See the [plotly.js CHANGELOG](https://github.com/plotly/plotly.js/blob/master/CHANGELOG.md#2133----2022-07-25) for more information. Notable changes include:
99
- Add `selections`, `newselection` and `activeselection` layout attributes to have persistent and editable selections over cartesian subplots
1010
- Add `unselected.line.color` and `unselected.line.opacity` options to `parcoords` trace
1111
- Display Plotly's new logo in the modebar

‎doc/python/box-plots.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ jupyter:
55
text_representation:
66
extension: .md
77
format_name: markdown
8-
format_version: '1.2'
9-
jupytext_version: 1.4.2
8+
format_version: '1.3'
9+
jupytext_version: 1.13.7
1010
kernelspec:
11-
display_name: Python 3
11+
display_name: Python 3 (ipykernel)
1212
language: python
1313
name: python3
1414
language_info:
@@ -20,7 +20,7 @@ jupyter:
2020
name: python
2121
nbconvert_exporter: python
2222
pygments_lexer: ipython3
23-
version: 3.7.7
23+
version: 3.9.0
2424
plotly:
2525
description: How to make Box Plots in Python with Plotly.
2626
display_as: statistical
@@ -90,7 +90,7 @@ fig.show()
9090

9191
### Choosing The Algorithm For Computing Quartiles
9292

93-
By default, quartiles for box plots are computed using the `linear` method (for more about linear interpolation, see #10 listed on [http://www.amstat.org/publications/jse/v14n3/langford.html](http://www.amstat.org/publications/jse/v14n3/langford.html) and [https://en.wikipedia.org/wiki/Quartile](https://en.wikipedia.org/wiki/Quartile) for more details).
93+
By default, quartiles for box plots are computed using the `linear` method (for more about linear interpolation, see #10 listed on [http://jse.amstat.org/v14n3/langford.html](http://jse.amstat.org/v14n3/langford.html) and [https://en.wikipedia.org/wiki/Quartile](https://en.wikipedia.org/wiki/Quartile) for more details).
9494

9595
However, you can also choose to use an `exclusive` or an `inclusive` algorithm to compute quartiles.
9696

‎doc/python/indicator.md

+31-4
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ jupyter:
55
text_representation:
66
extension: .md
77
format_name: markdown
8-
format_version: '1.1'
9-
jupytext_version: 1.2.1
8+
format_version: '1.3'
9+
jupytext_version: 1.13.7
1010
kernelspec:
11-
display_name: Python 3
11+
display_name: Python 3 (ipykernel)
1212
language: python
1313
name: python3
1414
language_info:
@@ -20,7 +20,7 @@ jupyter:
2020
name: python
2121
nbconvert_exporter: python
2222
pygments_lexer: ipython3
23-
version: 3.7.3
23+
version: 3.9.0
2424
plotly:
2525
description: How to make gauge charts in Python with Plotly.
2626
display_as: financial
@@ -61,6 +61,8 @@ In this tutorial we introduce a new trace named "Indicator". The purpose of "ind
6161
<li> (increasing|decreasing).symbol: symbol displayed on the left of the delta</li>
6262
<li> font.(family|size): to control the font</li>
6363
<li> position: position relative to `number` (either top, left, bottom, right)</li>
64+
<li> prefix: a string to appear before the delta
65+
<li> suffix: a string to appear after the delta
6466
</ol>
6567
Finally, we can have a simple title for the indicator via `title` with 'text' attribute which is a string, and 'align' which can be set to left, center, and right.
6668
There are two gauge types: [angular](https://plotly.com/python/gauge-charts/) and [bullet](https://plotly.com/python/bullet-charts/). Here is a combination of both shapes (angular, bullet), and different modes (gauge, delta, and value):
@@ -201,6 +203,31 @@ fig.add_trace(go.Indicator(
201203
fig.show()
202204
```
203205

206+
#### Adding a Prefix and Suffix
207+
208+
209+
On both a `number` and a `delta`, you can add a string to appear before the value using `prefix`. You can add a string to appear after the value using `suffix`. In the following example, we add '$' as a `prefix` and 'm' as `suffix` for both the `number` and `delta`.
210+
211+
Note: `suffix` and `prefix` on `delta` are new in 5.10
212+
213+
```python
214+
import plotly.graph_objects as go
215+
216+
fig = go.Figure(go.Indicator(
217+
mode = "number+delta",
218+
value = 492,
219+
number = {"prefix": "$", "suffix": "m"},
220+
delta = {"reference": 512, "valueformat": ".0f", "prefix": "$", "suffix": "m"},
221+
title = {"text": "Profit"},
222+
domain = {'y': [0, 1], 'x': [0.25, 0.75]}))
223+
224+
fig.add_trace(go.Scatter(
225+
y = [325, 324, 405, 400, 424, 404, 417, 432, 419, 394, 410, 426, 413, 419, 404, 408, 401, 377, 368, 361, 356, 359, 375, 397, 394, 418, 437, 450, 430, 442, 424, 443, 420, 418, 423, 423, 426, 440, 437, 436, 447, 460, 478, 472, 450, 456, 436, 418, 429, 412, 429, 442, 464, 447, 434, 457, 474, 480, 499, 497, 480, 502, 512, 492]))
226+
227+
fig.update_layout(xaxis = {'range': [0, 62]})
228+
fig.show()
229+
```
230+
204231
#### Reference
205232
See https://plotly.com/python/reference/indicator/ for more information and chart attribute options!
206233

‎doc/python/parallel-coordinates-plot.md

+37-4
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ jupyter:
55
text_representation:
66
extension: .md
77
format_name: markdown
8-
format_version: '1.1'
9-
jupytext_version: 1.1.1
8+
format_version: '1.3'
9+
jupytext_version: 1.13.7
1010
kernel_info:
1111
name: python2
1212
kernelspec:
13-
display_name: Python 3
13+
display_name: Python 3 (ipykernel)
1414
language: python
1515
name: python3
1616
language_info:
@@ -22,7 +22,7 @@ jupyter:
2222
name: python
2323
nbconvert_exporter: python
2424
pygments_lexer: ipython3
25-
version: 3.7.3
25+
version: 3.9.0
2626
plotly:
2727
description: How to make parallel coordinates plots in Python with Plotly.
2828
display_as: scientific
@@ -171,6 +171,39 @@ fig = go.Figure(data=
171171
fig.show()
172172
```
173173

174+
### Unselected Line Color and Opacity
175+
176+
177+
*New in 5.10*
178+
179+
The color and opacity of unselected lines can be set with `unselected`. By setting `opacity=0`, you can hide the unselected lines. Here, we set the color to `lightgray` and the opacity to `0.5`.
180+
181+
```python
182+
import plotly.graph_objects as go
183+
184+
fig = go.Figure(data=
185+
go.Parcoords(
186+
line_color='blue',
187+
dimensions = list([
188+
dict(range = [1,5],
189+
constraintrange = [1,2], # change this range by dragging the pink line
190+
label = 'A', values = [1,4]),
191+
dict(range = [1.5,5],
192+
tickvals = [1.5,3,4.5],
193+
label = 'B', values = [3,1.5]),
194+
dict(range = [1,5],
195+
tickvals = [1,2,4,5],
196+
label = 'C', values = [2,4],
197+
ticktext = ['text 1', 'text 2', 'text 3', 'text 4']),
198+
dict(range = [1,5],
199+
label = 'D', values = [4,2])
200+
]),
201+
unselected = dict(line = dict(color = 'green', opacity = 0.5))
202+
)
203+
)
204+
fig.show()
205+
```
206+
174207
#### Reference
175208

176209
See [function reference for `px.(parallel_coordinates)`](https://plotly.com/python-api-reference/generated/plotly.express.parallel_coordinates) or https://plotly.com/python/reference/parcoords/ for more information and chart attribute options!

0 commit comments

Comments
 (0)