Skip to content

Update docs #4135

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 48 commits into from
Mar 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
8c1c992
Allowing hover_data and custom_data to pass string of column name ins…
lukefeilberg Feb 21, 2023
c216146
Small fix to still allow lists for hover data
lukefeilberg Mar 5, 2023
3b5f51d
Removed check for hover_data in dataframe, which is taken care of later
lukefeilberg Mar 5, 2023
6093eaf
Added tests for hover data as a bare string
lukefeilberg Mar 5, 2023
c481b93
Merge branch 'master' into string-for-hover-data
nicolaskruchten Mar 6, 2023
8a151e1
Merge pull request #4083 from lukefeilberg/string-for-hover-data
nicolaskruchten Mar 6, 2023
f5846c7
check for keys to be added to plotly_obj before calculating error mes…
bmaranville Mar 14, 2023
6d5e1d7
'obj' was sometimes not None, but still did not have _valid_props att…
bmaranville Mar 14, 2023
c795b3b
use double-quotes as suggested by black
bmaranville Mar 14, 2023
db090b8
label aliases example
LiamConnors Mar 14, 2023
2faa203
Update axes.md
LiamConnors Mar 14, 2023
3ccc3f1
Update shapes.md
LiamConnors Mar 14, 2023
03115ad
Update shapes.md
LiamConnors Mar 14, 2023
7d242e5
Update shapes.md
LiamConnors Mar 14, 2023
59eef9b
Update axes.md
LiamConnors Mar 14, 2023
3b3f98a
Update shapes.md
LiamConnors Mar 15, 2023
52e0469
Update horizontal-vertical-shapes.md
LiamConnors Mar 15, 2023
23a0068
plotlyjs version updates
LiamConnors Mar 15, 2023
3eb06f6
Update horizontal-vertical-shapes.md
LiamConnors Mar 15, 2023
e5cd7b5
Update axes.md
LiamConnors Mar 15, 2023
6722474
update to plotyjs 2.20.0
LiamConnors Mar 15, 2023
9670c4a
Update figure-labels.md
LiamConnors Mar 16, 2023
ae1604a
update styles and formatting
LiamConnors Mar 16, 2023
1757231
Update figure-labels.md
LiamConnors Mar 16, 2023
ce425be
Update doc/python/shapes.md
LiamConnors Mar 16, 2023
b164c73
Update doc/python/shapes.md
LiamConnors Mar 16, 2023
97d0c6d
Fix `px.histogram` docstring typo
willfrey Mar 16, 2023
bb1d232
Merge pull request #4112 from willfrey/patch-1
nicolaskruchten Mar 16, 2023
707fb29
Update colorscales.md
LiamConnors Mar 16, 2023
81fe0bd
Merge branch 'march-docs' of https://github.com/plotly/plotly.py into…
LiamConnors Mar 16, 2023
66af1f2
Merge branch 'master' into march-docs
nicolaskruchten Mar 16, 2023
b95315e
require package packaging
alexcjohnson Mar 16, 2023
c82aad7
Update packages/python/plotly/plotly/basedatatypes.py
alexcjohnson Mar 16, 2023
e88f019
Merge pull request #4101 from bmaranville/dont_precalculate_key_error
alexcjohnson Mar 17, 2023
9050c4b
Merge pull request #4113 from plotly/req-packaging
alexcjohnson Mar 17, 2023
1860acc
Specify utf-8 in script tag
not522 Mar 17, 2023
7be3b7d
Merge branch 'master' into march-docs
LiamConnors Mar 20, 2023
690afe0
Update aggregations.md
LiamConnors Mar 21, 2023
846d1f7
Update CHANGELOG.md
LiamConnors Mar 27, 2023
f4609fc
Merge pull request #4104 from plotly/march-docs
archmoj Mar 28, 2023
5351836
Merge pull request #4114 from not522/utf-8
archmoj Mar 28, 2023
8a75262
version changes for v5.14.0
LiamConnors Mar 28, 2023
ac674ef
Update README.md
LiamConnors Mar 28, 2023
ab8687d
update changelog
LiamConnors Mar 28, 2023
31e97dc
fix date
LiamConnors Mar 29, 2023
c798545
Merge pull request #4128 from plotly/release-5.14.0
LiamConnors Mar 29, 2023
5b7cff6
update docs version
LiamConnors Mar 29, 2023
743b524
Merge pull request #4134 from plotly/update-docs-version
LiamConnors Mar 29, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,25 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## [5.14.0] - 2023-03-29

### Updated
- Updated Plotly.js to from version 2.18.2 to version 2.20.0. See the [plotly.js CHANGELOG](https://github.com/plotly/plotly.js/blob/master/CHANGELOG.md#2200----2023-03-15) for more information. Notable changes include:
- Add `title.automargin` to enable automatic top and bottom margining for both container and paper referenced titles [[#6428](https://github.com/plotly/plotly.js/pull/6428)],
with thanks to [Gamma Technologies](https://www.gtisoft.com/) for sponsoring the related development.
- Add `label` attribute to shapes [[#6454](https://github.com/plotly/plotly.js/pull/6454)], with thanks to the [Volkswagen](https://www.volkswagenag.com) Center of Excellence for Battery Systems for sponsoring development!
- Add `labelalias` to various axes namely cartesian, gl3d, polar, smith, ternary, carpet,
indicator and colorbar [[#6481](https://github.com/plotly/plotly.js/pull/6481)],
this feature was anonymously sponsored: thank you to our sponsor!
- Key errors no longer precalculated when performing updates on plots [[#4101](https://github.com/plotly/plotly.py/pull/4101)]

### Fixed
- Fixed an issue with characters displaying incorrectly, by adding `charset="utf-8"` to scripts in `to_html` [[#4114](https://github.com/plotly/plotly.py/pull/4114)]
- Added `packaging` to install requirements, fixing a `No module named 'packaging` error on Python 3.6 [[#4113](https://github.com/plotly/plotly.py/pull/4113)]

### Added
- Added option to allow passing a column name as a `str` in `hover_data` and `custom_data` in `plotly.express` [[4083](https://github.com/plotly/plotly.py/pull/4083)]

## [5.13.1] - 2023-02-24

### Updated
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

## Quickstart

`pip install plotly==5.13.1`
`pip install plotly==5.14.0`

Inside [Jupyter](https://jupyter.org/install) (installable with `pip install "jupyterlab>=3" "ipywidgets>=7.6"`):

Expand Down Expand Up @@ -78,13 +78,13 @@ Built on top of [plotly.js](https://github.com/plotly/plotly.js), `plotly.py` is
plotly.py may be installed using pip...

```
pip install plotly==5.13.1
pip install plotly==5.14.0
```

or conda.

```
conda install -c plotly plotly=5.13.1
conda install -c plotly plotly=5.14.0
```

### JupyterLab Support
Expand All @@ -106,7 +106,7 @@ The instructions above apply to JupyterLab 3.x. **For JupyterLab 2 or earlier**,

```
# JupyterLab 2.x renderer support
jupyter labextension install jupyterlab-plotly@5.13.1 @jupyter-widgets/jupyterlab-manager
jupyter labextension install jupyterlab-plotly@5.14.0 @jupyter-widgets/jupyterlab-manager
```

Please check out our [Troubleshooting guide](https://plotly.com/python/troubleshooting/) if you run into any problems with JupyterLab.
Expand Down
2 changes: 1 addition & 1 deletion binder/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
jupytext
plotly==5.13.1
plotly==5.14.0
jupyter
notebook
pandas==1.0.3
Expand Down
2 changes: 1 addition & 1 deletion doc/apidoc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
# The short X.Y version
version = ""
# The full version, including alpha/beta/rc tags
release = "5.13.1"
release = "5.14.0"


# -- General configuration ---------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion doc/python/aggregations.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ import plotly.io as pio

import pandas as pd

df = pd.read_csv("https://plotly.com/~public.health/17.csv")
df = pd.read_csv("https://raw.githubusercontent.com/plotly/datasets/master/US-shooting-incidents.csv")

data = [dict(
x = df['date'],
Expand Down
19 changes: 19 additions & 0 deletions doc/python/axes.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,25 @@ fig.update_yaxes(ticklabelposition="inside top", title=None)
fig.show()
```

#### Specifying Label Aliases

*New in 5.14*

With `labelalias`, you can specify replacement text for specific tick and hover labels. In this example, the dataset has the values of "Sat" and "Sun" in the day column. By setting `labelalias=dict(Sat="Saturday", Sun="Sunday")`, we swap these out for "Saturday" and "Sunday".

```python
import plotly.express as px
import pandas as pd

df = px.data.tips()
df = df[df.day.isin(['Sat', 'Sun'])].groupby(by='day', as_index=False).sum(numeric_only=True)

fig = px.bar(df, x="day", y="total_bill")
fig.update_xaxes(labelalias=dict(Sat="Saturday", Sun="Sunday"))

fig.show()
```

##### Set axis title text with Graph Objects

Axis titles are set using the nested `title.text` property of the x or y axis. Here is an example of creating a new figure and using `update_xaxes` and `update_yaxes`, with magic underscore notation, to set the axis titles.
Expand Down
41 changes: 38 additions & 3 deletions doc/python/colorscales.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ jupyter:
extension: .md
format_name: markdown
format_version: '1.3'
jupytext_version: 1.14.1
jupytext_version: 1.14.5
kernelspec:
display_name: Python 3
display_name: Python 3 (ipykernel)
language: python
name: python3
language_info:
Expand All @@ -20,7 +20,7 @@ jupyter:
name: python
nbconvert_exporter: python
pygments_lexer: ipython3
version: 3.8.8
version: 3.10.9
plotly:
description: How to set, create and control continuous color scales and color
bars in scatter, bar, map and heatmap figures.
Expand Down Expand Up @@ -298,6 +298,41 @@ fig.update_layout(coloraxis_colorbar=dict(
fig.show()
```

### Using Label Aliases on Colorbars

*New in 5.14*

Using `labelalias` you can replace some labels on the `colorbar` with alternative values. In this example, the `colorbar` has five `tickvals`. Using `labelalias`, instead of displaying all labels as the numbers in `tickvals`, we swap out three of the labels for text.

```python
import plotly.graph_objects as go

import urllib
import json

# Load heatmap data
response = urllib.request.urlopen(
"https://raw.githubusercontent.com/plotly/datasets/master/custom_heatmap_colorscale.json")
dataset = json.load(response)

# Create and show figure
fig = go.Figure()

fig.add_trace(go.Heatmap(
z=dataset["z"],
colorbar=dict(
title="Surface Heat",
titleside="top",
tickmode="array",
tickvals=[2, 25, 50, 75, 100],
labelalias={100: "Hot", 50: "Mild", 2: "Cold"},
ticks="outside"
)
))

fig.show()
```

### Custom Discretized Heatmap Color scale with Graph Objects

```python
Expand Down
26 changes: 23 additions & 3 deletions doc/python/figure-labels.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ jupyter:
extension: .md
format_name: markdown
format_version: '1.3'
jupytext_version: 1.14.1
jupytext_version: 1.14.5
kernelspec:
display_name: Python 3
display_name: Python 3 (ipykernel)
language: python
name: python3
language_info:
Expand All @@ -20,7 +20,7 @@ jupyter:
name: python
nbconvert_exporter: python
pygments_lexer: ipython3
version: 3.8.8
version: 3.10.9
plotly:
description: How to set the global font, title, legend-entries, and axis-titles
in python.
Expand Down Expand Up @@ -86,6 +86,26 @@ fig.update_xaxes(title_font_family="Arial")
fig.show()
```

### Set Automargin on the Plot Title

*New in 5.14*

Set `automargin=True` to allow the title to push the figure margins. With `yref` set to `paper`, `automargin=True` expands the margins to make the title visible, but doesn't push outside the container. With `yref` set to `container`, `automargin=True` expands the margins, but the title doesn't overlap with the plot area, tick labels, and axis titles.


```python
import plotly.express as px

df = px.data.gapminder().query("continent == 'Oceania'")
fig = px.line(df, x="year", y="gdpPercap", color="country")

fig.update_layout(
title=dict(text="GDP-per-capita", font=dict(size=50), automargin=True, yref='paper')
)

fig.show()
```

### Fonts and Labels in Dash

[Dash](https://plotly.com/dash/) is the best way to build analytical apps in Python using Plotly figures. To run the app below, run `pip install dash dash-daq`, click "Download" to get the code and run `python app.py`.
Expand Down
6 changes: 3 additions & 3 deletions doc/python/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ We also encourage you to join the [Plotly Community Forum](http://community.plot
`plotly` may be installed using `pip`:

```
$ pip install plotly==5.13.1
$ pip install plotly==5.14.0
```

or `conda`:

```
$ conda install -c plotly plotly=5.13.1
$ conda install -c plotly plotly=5.14.0
```
This package contains everything you need to write figures to standalone HTML files.

Expand Down Expand Up @@ -152,7 +152,7 @@ The instructions above apply to JupyterLab 3.x. **For JupyterLab 2 or earlier**,

```
# JupyterLab 2.x renderer support
jupyter labextension install jupyterlab-plotly@5.13.1 @jupyter-widgets/jupyterlab-manager
jupyter labextension install jupyterlab-plotly@5.14.0 @jupyter-widgets/jupyterlab-manager
```

Please check out our [Troubleshooting guide](/python/troubleshooting/) if you run into any problems with JupyterLab, particularly if you are using multiple python environments inside Jupyter.
Expand Down
41 changes: 41 additions & 0 deletions doc/python/horizontal-vertical-shapes.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,47 @@ fig.add_vrect(x0="2018-09-24", x1="2018-12-18", row="all", col=1,
fillcolor="green", opacity=0.25, line_width=0)
fig.show()
```
#### Text Labels on Shapes

*New in 5.14*

[Text labels on shapes](/python/shapes/#addingtextlabelstoshapes), introduced in version 5.14, is now the recommended way to add text to shapes. The above examples using `add_hline`, `add_vrect`, `add_hrect`, and `add_vline` that add annotations can be rewritten to use `label`.


```python
import plotly.express as px

df = px.data.stocks(indexed=True)
fig = px.line(df)
fig.add_hline(
y=1,
line_dash="dot",
label=dict(
text="Jan 1 2018 Baseline",
textposition="end",
font=dict(size=20, color="blue"),
yanchor="top",
),
)
fig.add_vrect(
x0="2018-09-24",
x1="2018-12-18",
label=dict(
text="Decline",
textposition="top center",
font=dict(size=20, family="Times New Roman"),
),
fillcolor="green",
opacity=0.25,
line_width=0,
)
fig.show()

```

With [text labels on shapes](/python/shapes/#addingtextlabelstoshapes), you can also add text labels to shapes other than lines and rectangles, and the labels can be added automatically to shapes drawn by the user.


### Reference

More details are available about [layout shapes](/python/shapes/) and [annotations](/python/text-and-annotations).
Expand Down
Loading