Skip to content

Commit 0825d28

Browse files
authored
Merge branch 'master' into shape-drawing-doc
2 parents 8b9ae38 + 3c1a7d1 commit 0825d28

File tree

1,061 files changed

+4304
-1682
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,061 files changed

+4304
-1682
lines changed

.circleci/create_conda_optional_env.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ if [ ! -d $HOME/miniconda/envs/circle_optional ]; then
1616
# Create environment
1717
# PYTHON_VERSION=2.7 or 3.5
1818
$HOME/miniconda/bin/conda create -n circle_optional --yes python=$PYTHON_VERSION \
19-
requests nbformat six retrying psutil pandas decorator pytest mock nose poppler xarray scikit-image ipython jupyter ipykernel ipywidgets
19+
requests nbformat six retrying psutil pandas decorator pytest mock nose poppler xarray scikit-image ipython jupyter ipykernel ipywidgets statsmodels
2020

2121
# Install orca into environment
2222
$HOME/miniconda/bin/conda install --yes -n circle_optional -c plotly plotly-orca==1.3.1

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@ This project adheres to [Semantic Versioning](http://semver.org/).
1616
makes it possible to skip hover information for some arguments or to change
1717
the formatting of hover informatiom [#2377](https://github.com/plotly/plotly.py/pull/2377).
1818

19+
### Performance
20+
This version includes several performance improvements ([#2368](https://github.com/plotly/plotly.py/pull/2368), [#2403](https://github.com/plotly/plotly.py/pull/2403)).
21+
22+
- Child graph objects (e.g. `figure.layout.xaxis`) are no longer created eagerly during graph object construction. Instead, they are created lazily the first time the property is accessed.
23+
- Property validation is now disabled for select internal operations.
24+
- When used with Python 3.7 and above, ploty.py now takes advantage of [PEP-562](https://www.python.org/dev/peps/pep-0562/) to perform submodule imports lazily. This dramatically improves import times.
25+
1926
## [4.6] - 2020-03-31
2027

2128
### Updated

doc/apidoc/Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,15 @@ help:
1818
# For sphinx-apidoc the first positional path is the module to document
1919
# then all the other ones are paths to exclude for the doc generation
2020
%: Makefile
21+
sed -i 's/:class:`plotly.graph_objects/:class:`plotly.graph_objs/g' ../../packages/python/plotly/plotly/graph_objs/*.py
22+
sed -i 's/:class:`plotly.graph_objects/:class:`plotly.graph_objs/g' ../../packages/python/plotly/plotly/graph_objs/*/*.py
23+
sed -i 's/:class:`plotly.graph_objects/:class:`plotly.graph_objs/g' ../../packages/python/plotly/plotly/graph_objs/*/*/*.py
24+
sed -i 's/:class:`plotly.graph_objects/:class:`plotly.graph_objs/g' ../../packages/python/plotly/plotly/graph_objs/*/*/*/*.py
2125
sphinx-apidoc -o generated ../../packages/python/plotly/plotly ../../packages/python/plotly/plotly/validators ../../packages/python/plotly/plotly/tests ../../packages/python/plotly/plotly/matplotlylib/ ../../packages/python/plotly/plotly/offline ../../packages/python/plotly/plotly/api
2226
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
27+
git checkout -- ../../packages/python/plotly/plotly/graph_objs
2328
rename 's/graph_objs/graph_objects/' _build/html/*.html _build/html/generated/*.html
29+
mv _build/html/generated/plotly.graph_objs.html _build/html/generated/plotly.graph_objects.html
2430
sed -i 's/graph_objs/graph_objects/g' _build/html/*.html
2531
sed -i 's/graph_objs/graph_objects/g' _build/html/*.inv
2632
sed -i 's/graph_objs/graph_objects/g' _build/html/*.js

doc/apidoc/_templates/trace.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515

1616
.. autosummary::
1717

18-
plotly.graph_objects.{{ objname.lower() }}
18+
plotly.graph_objs.{{ objname.lower() }}
1919

20-
.. automodule:: plotly.graph_objects.{{ objname.lower() }}
20+
.. automodule:: plotly.graph_objs.{{ objname.lower() }}
2121
:members:
2222
:undoc-members:
2323

doc/python/animations.md

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -261,18 +261,6 @@ fig_dict = {
261261
fig_dict["layout"]["xaxis"] = {"range": [30, 85], "title": "Life Expectancy"}
262262
fig_dict["layout"]["yaxis"] = {"title": "GDP per Capita", "type": "log"}
263263
fig_dict["layout"]["hovermode"] = "closest"
264-
fig_dict["layout"]["sliders"] = {
265-
"args": [
266-
"transition", {
267-
"duration": 400,
268-
"easing": "cubic-in-out"
269-
}
270-
],
271-
"initialValue": "1952",
272-
"plotlycommand": "animate",
273-
"values": years,
274-
"visible": True
275-
}
276264
fig_dict["layout"]["updatemenus"] = [
277265
{
278266
"buttons": [

doc/python/datashader.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jupyter:
3636

3737
[datashader](https://datashader.org/) creates rasterized representations of large datasets for easier visualization, with a pipeline approach consisting of several steps: projecting the data on a regular grid, creating a color representation of the grid, etc.
3838

39-
### Passing datashader rasters as a mabox image layer
39+
### Passing datashader rasters as a mapbox image layer
4040

4141
We visualize here the spatial distribution of taxi rides in New York City. A higher density
4242
is observed on major avenues. For more details about mapbox charts, see [the mapbox layers tutorial](/python/mapbox-layers). No mapbox token is needed here.

doc/python/hover-text-and-formatting.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,10 @@ fig.show()
170170
### Customizing hover text with a hovertemplate
171171

172172
To customize the tooltip on your graph you can use the [hovertemplate](https://plotly.com/python/reference/#pie-hovertemplate) attribute of `graph_objects` tracces, which is a template string used for rendering the information that appear on hoverbox.
173-
This template string can include `variables` in %{variable} format, `numbers` in [d3-format's syntax](https://github.com/d3/d3-3.x-api-reference/blob/master/Formatting.md#d3_forma), and `date` in [d3-time-format's syntax](https://github.com/d3/d3-3.x-api-reference/blob/master/Time-Formatting.md#format).
174-
Hovertemplate customize the tooltip text vs. [texttemplate](https://plotly.com/python/reference/#pie-texttemplate) which customizes the text that appears on your chart. <br>
173+
This template string can include `variables` in %{variable} format, `numbers` in [d3-format's syntax](https://github.com/d3/d3-3.x-api-reference/blob/master/Formatting.md#d3_forma), and `date` in [d3-time-format's syntax](https://github.com/d3/d3-3.x-api-reference/blob/master/Time-Formatting.md#format). In the example below, the empty `<extra></extra>` tag removes the part of the hover where the trace name is usually displayed in a contrasting color. The `<extra>` tag can be used to display other parts of the hovertemplate, it is not reserved for the trace name.
174+
175+
Note that a hovertemplate customizes the tooltip text, while a [texttemplate](https://plotly.com/python/reference/#pie-texttemplate) customizes the text that appears on your chart. <br>
176+
175177
Set the horizontal alignment of the text within tooltip with [hoverlabel.align](https://plotly.com/python/reference/#layout-hoverlabel-align).
176178

177179
```python

doc/python/imshow.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ jupyter:
66
extension: .md
77
format_name: markdown
88
format_version: '1.2'
9-
jupytext_version: 1.3.0
9+
jupytext_version: 1.4.2
1010
kernelspec:
1111
display_name: Python 3
1212
language: python

doc/python/legend.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ fig.add_trace(go.Scatter(
159159
name="Decreasing"
160160
))
161161

162-
fig.update_layout(legend_title='<b> Trend </b>')
162+
fig.update_layout(legend_title_text='Trend')
163163
fig.show()
164164
```
165165

doc/python/sliders.md

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ jupyter:
3333
thumbnail: thumbnail/slider2017.gif
3434
---
3535

36-
#### Simple Slider Control
37-
Sliders can now be used in Plotly to change the data displayed or style of a plot!
36+
### Simple Slider Control
37+
Sliders can be used in Plotly to change the data displayed or style of a plot.
3838

3939
```python
4040
import plotly.graph_objects as go
@@ -60,10 +60,11 @@ fig.data[10].visible = True
6060
steps = []
6161
for i in range(len(fig.data)):
6262
step = dict(
63-
method="restyle",
64-
args=["visible", [False] * len(fig.data)],
63+
method="update",
64+
args=[{"visible": [False] * len(fig.data)},
65+
{"title": "Slider switched to step: " + str(i)}], # layout attribute
6566
)
66-
step["args"][1][i] = True # Toggle i'th trace to "visible"
67+
step["args"][0]["visible"][i] = True # Toggle i'th trace to "visible"
6768
steps.append(step)
6869

6970
sliders = [dict(
@@ -80,5 +81,27 @@ fig.update_layout(
8081
fig.show()
8182
```
8283

84+
#### Methods
85+
The method determines which [plotly.js function](https://plot.ly/javascript/plotlyjs-function-reference/) will be used to update the chart. Plotly can use several [updatemenu](https://plot.ly/python/reference/#layout-updatemenus-items-updatemenu-buttons-items-button-method) methods to add the slider:
86+
- `"restyle"`: modify **data** attributes
87+
- `"relayout"`: modify **layout** attributes
88+
- `"update"`: modify **data and layout** attributes
89+
- `"animate"`: start or pause an animation
90+
91+
### Sliders in Plotly Express
92+
Plotly Express provide sliders, but with implicit animation. The animation can be ommited by removing `updatemenus` in the `layout`:
93+
94+
```python
95+
import plotly.express as px
96+
97+
df = px.data.gapminder()
98+
fig = px.scatter(df, x="gdpPercap", y="lifeExp", animation_frame="year", animation_group="country",
99+
size="pop", color="continent", hover_name="country",
100+
log_x=True, size_max=55, range_x=[100,100000], range_y=[25,90])
101+
102+
fig["layout"].pop("updatemenus") # optional, drop animation buttons
103+
fig.show()
104+
```
105+
83106
#### Reference
84107
Check out https://plotly.com/python/reference/#layout-updatemenus for more information!

0 commit comments

Comments
 (0)