Skip to content
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
8a148f2
Switch to use anywidget
Jul 14, 2024
e21e3d7
Merge branch 'master' of github.com:plotly/plotly.py into anywidget
marthacryan Sep 12, 2024
d5d245c
Merge branch 'remove-requirejs' of github.com:plotly/plotly.py into a…
marthacryan Sep 13, 2024
6355ee4
Add package.json esbuild command and update test requirements to incl…
marthacryan Sep 13, 2024
3abdc7f
Call bundle command in the CI
marthacryan Sep 13, 2024
88b327e
Fix filepath
marthacryan Sep 13, 2024
70d536f
Move js stuff to plotly
manzt Sep 16, 2024
3b9c192
Cleanup tsconfig and types for build
manzt Sep 16, 2024
a338e6f
Ignore bundle
manzt Sep 16, 2024
aaefdaf
Keep bundle in MANIFEST.in
manzt Sep 16, 2024
ebba1c5
Restore package/* from master
manzt Sep 16, 2024
6d2a372
Update target
manzt Sep 16, 2024
b27643d
Add anywidget comment
manzt Sep 16, 2024
d4277ac
Merge branch 'master' of github.com:plotly/plotly.py into anywidget
marthacryan Oct 9, 2024
e7b6d7a
Add warning message when notebook version < 7 is used
marthacryan Oct 11, 2024
590a4db
Move files under python/plotly
marthacryan Oct 11, 2024
cd7d587
remove old javascript and fix install
marthacryan Oct 15, 2024
4f2ce95
Remove nbextension
marthacryan Oct 15, 2024
cc77778
Reset changes to circleci
marthacryan Oct 17, 2024
23f387a
Merge branch 'master' of github.com:plotly/plotly.py into anywidget
marthacryan Oct 17, 2024
c53835e
Undo changes to CHANGELOG
marthacryan Oct 17, 2024
0c9ffc9
Revert changes to javascript directory
marthacryan Oct 17, 2024
0f16f0c
remove all jupyter extension code
marthacryan Oct 18, 2024
d1e24db
Add jsdeps to ci config
marthacryan Oct 18, 2024
5eff0ca
Merge branch 'anywidget' of github.com:marthacryan/plotly.py into dro…
marthacryan Oct 18, 2024
195ea4e
Merge with master
marthacryan Oct 21, 2024
ce96898
Add dep on anywidget
marthacryan Oct 21, 2024
a3d8650
Update error messages when anywidget isn't installed
marthacryan Oct 21, 2024
3bc3535
Update docstring
marthacryan Oct 21, 2024
b5870e8
Update test to rely on installation of anywidget rather than version
marthacryan Oct 21, 2024
9302d29
Rename widget test
marthacryan Oct 21, 2024
a60e803
Black
marthacryan Oct 21, 2024
54d9fe4
Update setup.py to include both widget and jupyterlab extension build
marthacryan Oct 21, 2024
204b052
fix filepath of jupyterlab extension root
marthacryan Oct 21, 2024
263ef26
Update circleci config to include both widget and jupyterlab extensio…
marthacryan Oct 21, 2024
846e7b5
Fix formatting of config file
marthacryan Oct 21, 2024
08d8052
Update circleci config to include both widget and jupyterlab extensio…
marthacryan Oct 21, 2024
28b27af
revert changes to pypi build
marthacryan Oct 21, 2024
eb70d86
Black
marthacryan Oct 21, 2024
a911f53
Remove extra call to setup.py
marthacryan Oct 21, 2024
2a7208f
Add jsdeps call to optional tests
marthacryan Oct 21, 2024
45fca22
Move jsdeps call to core tests
marthacryan Oct 21, 2024
cae0088
Reset javascript file
marthacryan Oct 22, 2024
93210e6
Move jsdeps to an earlier step
marthacryan Oct 22, 2024
f553634
Move jsdeps to an earlier step
marthacryan Oct 22, 2024
7664ac9
Merge branch 'master' of github.com:plotly/plotly.py into anywidget
marthacryan Oct 22, 2024
3578bac
Call npm run build directly in circle ci config
marthacryan Oct 22, 2024
0920b9d
restore changes to setup.py
marthacryan Oct 22, 2024
2dbdcea
Reset widget version
marthacryan Oct 22, 2024
612ceec
Merge with anywidget branch
marthacryan Oct 22, 2024
cb488ff
Remove npm from release instructions
marthacryan Oct 22, 2024
4096595
Remove more references to jupyterlab-plotly
marthacryan Oct 22, 2024
20886ef
Resolve ci failures
marthacryan Oct 22, 2024
f8fe306
Merge with anywidget
marthacryan Oct 22, 2024
35f848b
Fix filepath of bundled js
marthacryan Oct 23, 2024
3f6c8f7
Fix filepath to js bundle in setup.py
marthacryan Oct 23, 2024
5b97f05
Install before running npm build in ci
marthacryan Oct 23, 2024
3b94298
Merge branch 'anywidget' of github.com:plotly/plotly.py into drop-not…
marthacryan Oct 23, 2024
513798b
Remove npm pack of jupyterlab extension
marthacryan Oct 23, 2024
cede4e1
Remove requirement for ipywidgets
marthacryan Oct 23, 2024
a80250d
Move build step of js
marthacryan Oct 23, 2024
99013dc
Move widget bundle to package_data
marthacryan Oct 23, 2024
4ab2a0c
Update path in gitignore
marthacryan Oct 23, 2024
39e65af
Merge branch 'anywidget' of github.com:plotly/plotly.py into drop-not…
marthacryan Oct 23, 2024
25cbf52
Merge branch 'anywidget' of github.com:plotly/plotly.py into drop-not…
marthacryan Oct 23, 2024
8e3354d
Update path of bundle in setup.py
marthacryan Oct 23, 2024
60cc98f
update contributing to include new build instructions
marthacryan Oct 25, 2024
ce607bb
Merge branch 'master' of github.com:plotly/plotly.py into anywidget
marthacryan Oct 28, 2024
3d2a234
Merge branch 'anywidget' of github.com:plotly/plotly.py into drop-not…
marthacryan Oct 28, 2024
6d29ba6
Fix issues with vscode
marthacryan Oct 30, 2024
21fa7d0
Update to include lodash-es in package.json
marthacryan Oct 30, 2024
4bb303c
remove unnecessary global define
marthacryan Oct 30, 2024
4759697
Merge with anywidget
marthacryan Oct 30, 2024
e399c2d
Pin anywidget version in test requirements
marthacryan Oct 30, 2024
f6f2691
Remove more references to old jupyter support from README
marthacryan Nov 4, 2024
ee67f2e
Merge pull request #4822 from plotly/drop-notebook-6
marthacryan Nov 4, 2024
97d6cb1
Merge branch 'master' of github.com:plotly/plotly.py into anywidget
marthacryan Nov 4, 2024
7f241f3
Merge branch 'master' of github.com:plotly/plotly.py into anywidget
marthacryan Nov 7, 2024
dc87b3c
Create util for display jupyter version warnings and update imports
marthacryan Nov 7, 2024
22d90c4
Remove deprecated code
marthacryan Nov 7, 2024
bee13cd
Update jupyter version warnings to import jupyterlab later
marthacryan Nov 8, 2024
946590f
Merge with master
marthacryan Nov 12, 2024
3a85b8a
Switch to npm ci instead of npm i
marthacryan Nov 12, 2024
fc8eff2
Move warnings out of utils file to avoid psutils import error
marthacryan Nov 12, 2024
c65ca44
Fix import paths for new location of util
marthacryan Nov 12, 2024
6d3f0a7
Remove unused import
marthacryan Nov 12, 2024
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
  •  
  •  
  •  
24 changes: 20 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ commands:
. venv/bin/activate
pip install --upgrade pip wheel
pip install -r ./test_requirements/requirements_<<parameters.py>>_optional.txt
python setup.py jsdeps
cd js
npm install
npm run build
- run:
name: Install plotly-geo
command: |
Expand Down Expand Up @@ -340,8 +342,9 @@ jobs:
. venv/bin/activate
pip install --upgrade pip wheel
pip install -r ./test_requirements/requirements_38_core.txt black inflect
pip install jupyterlab~=3.0
- run:
name: Update widget plotly.js version
name: Update jupyterlab-plotly and jupyter widget plotly.js version
command: |
cd packages/python/plotly
. venv/bin/activate
Expand Down Expand Up @@ -395,10 +398,20 @@ jobs:
conda config --remove channels defaults
conda config --add channels conda-forge
conda create -n env --yes python=3.9 conda-build=3.28.4 conda-verify
conda install -n env -c conda-forge nodejs=16
conda install -n env -c conda-forge jupyterlab=3 nodejs=16
conda init bash
mkdir output

- run:
name: initial NPM Build
command: |
eval "$(conda shell.bash hook)"
conda activate env
cd packages/javascript/jupyterlab-plotly
npm ci
npm run build:prod
git status

- run:
name: PyPI Build
command: |
Expand All @@ -424,7 +437,10 @@ jobs:
command: |
eval "$(conda shell.bash hook)"
conda activate env
cd packages/python/plotly/js
cd packages/javascript/jupyterlab-plotly
npm pack
mv jupyterlab-plotly*.tgz ../../../output
cd ../../python/plotly/js
npm run build
mv ../bundle.js ../../../../output

Expand Down
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

### Removed
- Drop deprecated `pointcloud` and `heatmapgl` traces from the API

### Updated

- Updated plotly.py to use base64 encoding of arrays in plotly JSON to improve performance.

## [5.24.1] - 2024-09-12

### Updated
Expand All @@ -21,6 +28,10 @@ This project adheres to [Semantic Versioning](http://semver.org/).

- Fixed a bug in integer validation of arrays that threw an error when an array contained a mix of strings and integers.

- Fixed a bug in JupyterLab >= 4 and Jupyter Notebook >= 7 that caused latex to not render in plotly charts.

- Use modern [native ES6 import](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules) to load plotly.js bundle instead of requirejs which is [no longer under active development](https://github.com/requirejs/r.js/compare/2.3.6...2.3.7)

## [5.23.0] - 2024-07-23

### Updated
Expand Down
8 changes: 3 additions & 5 deletions contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,7 @@ There are many ways to contribute to plotly.py. To contribute effectively, it is

- tests are found in `packages/python/plotly/plotly/tests`. Different
directories correspond to different test jobs (with different dependency sets)
run in continuous integration. These jobs are configured in
`packages/python/plotly/tox.ini`, which itself is used in the Circle CI
configuration file `.circleci/config.yml`. More is explained about tests
run in continuous integration. More is explained about tests
in the following "Technical aspects" section.

- the **documentation** is part of this repository. Its structure and some
Expand Down Expand Up @@ -231,10 +229,10 @@ For dev branches, it is also possible to use `updateplotlyjsdev` in two configur

### CircleCI Release

If your devbranch is part of the official plotly.js repository, you can use
If your devbranch is part of the official plotly.js repository, you can use
```bash
python setup.py updateplotlyjsdev --devrepo reponame --devbranch branchname
```
```
to update to development versions of `plotly.js`. This will fetch the `plotly.js` in the CircleCI artifact of the branch `branchname` of the repo `reponame`. If `--devrepo` or `--devbranch` are omitted, `updateplotlyjsdev` defaults using `plotly/plotly.js` and `master` respectively.

### Local Repository
Expand Down
1 change: 0 additions & 1 deletion doc/apidoc/plotly.graph_objects.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ Simple Traces
Bar
Pie
Heatmap
Heatmapgl
Image
Contour
Table
Expand Down
86 changes: 69 additions & 17 deletions doc/python/3d-bubble-charts.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ jupyter:
text_representation:
extension: .md
format_name: markdown
format_version: '1.1'
jupytext_version: 1.2.3
format_version: '1.3'
jupytext_version: 1.16.4
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.7.3
version: 3.11.10
plotly:
description: How to make 3D Bubble Charts in Python with Plotly. Three examples
of 3D Bubble Charts.
Expand Down Expand Up @@ -113,12 +113,38 @@ fig = go.Figure(data=go.Scatter3d(
)
))

fig.update_layout(width=800, height=800, title = 'Planets!',
scene = dict(xaxis=dict(title='Distance from Sun', titlefont_color='white'),
yaxis=dict(title='Density', titlefont_color='white'),
zaxis=dict(title='Gravity', titlefont_color='white'),
bgcolor = 'rgb(20, 24, 54)'
))
fig.update_layout(
width=800,
height=800,
title="Planets!",
scene=dict(
xaxis=dict(
title=dict(
text="Distance from Sun",
font=dict(
color="white"
)
)
),
yaxis=dict(
title=dict(
text="Density",
font=dict(
color="white"
)
)
),
zaxis=dict(
title=dict(
text="Gravity",
font=dict(
color="white"
)
)
),
bgcolor="rgb(20, 24, 54)"
)
)

fig.show()
```
Expand Down Expand Up @@ -154,16 +180,42 @@ fig = go.Figure(go.Scatter3d(
)
))

fig.update_layout(width=800, height=800, title = 'Planets!',
scene = dict(xaxis=dict(title='Distance from Sun', titlefont_color='white'),
yaxis=dict(title='Density', titlefont_color='white'),
zaxis=dict(title='Gravity', titlefont_color='white'),
bgcolor = 'rgb(20, 24, 54)'
))
fig.update_layout(
width=800,
height=800,
title="Planets!",
scene=dict(
xaxis=dict(
title=dict(
text="Distance from Sun",
font=dict(
color="white"
)
)
),
yaxis=dict(
title=dict(
text="Density",
font=dict(
color="white"
)
)
),
zaxis=dict(
title=dict(
text="Gravity",
font=dict(
color="white"
)
)
),
bgcolor="rgb(20, 24, 54)"
)
)

fig.show()
```

#### Reference

See https://plotly.com/python/reference/scatter3d/ and https://plotly.com/python/reference/scatter/#scatter-marker-sizeref <br>for more information and chart attribute options!
See https://plotly.com/python/reference/scatter3d/ and https://plotly.com/python/reference/scatter/#scatter-marker-sizeref <br>for more information and chart attribute options!
43 changes: 22 additions & 21 deletions doc/python/animations.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,7 @@ fig.show()

```python
import plotly.graph_objects as go

import numpy as np

# Generate curve data
t = np.linspace(-1, 1, 100)
x = t + t ** 2
Expand All @@ -156,7 +154,7 @@ xm = np.min(x) - 1.5
xM = np.max(x) + 1.5
ym = np.min(y) - 1.5
yM = np.max(y) + 1.5
N = 50
N = 25
s = np.linspace(-1, 1, N)
xx = s + s ** 2
yy = s - s ** 2
Expand All @@ -167,26 +165,29 @@ fig = go.Figure(
data=[go.Scatter(x=x, y=y,
mode="lines",
line=dict(width=2, color="blue")),
go.Scatter(x=x, y=y,
mode="lines",
line=dict(width=2, color="blue"))],
layout=go.Layout(
go.Scatter(x=[xx[0]], y=[yy[0]],
mode="markers",
marker=dict(color="red", size=10))])
fig.update_layout(width=600, height=450,
xaxis=dict(range=[xm, xM], autorange=False, zeroline=False),
yaxis=dict(range=[ym, yM], autorange=False, zeroline=False),
title_text="Kinematic Generation of a Planar Curve", hovermode="closest",
updatemenus=[dict(type="buttons",
buttons=[dict(label="Play",
method="animate",
args=[None])])]),
frames=[go.Frame(
data=[go.Scatter(
x=[xx[k]],
y=[yy[k]],
mode="markers",
marker=dict(color="red", size=10))])

for k in range(N)]
)
title_text="Kinematic Generation of a Planar Curve", title_x=0.5,
updatemenus = [dict(type = "buttons",
buttons = [
dict(
args = [None, {"frame": {"duration": 10, "redraw": False},
"fromcurrent": True, "transition": {"duration": 10}}],
label = "Play",
method = "animate",

)])])

fig.update(frames=[go.Frame(
data=[go.Scatter(
x=[xx[k]],
y=[yy[k]])],
traces=[1]) # fig.data[1] is updated by each frame
for k in range(N)])

fig.show()
```
Expand Down
21 changes: 12 additions & 9 deletions doc/python/bar-charts.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jupyter:

[Plotly Express](/python/plotly-express/) is the easy-to-use, high-level interface to Plotly, which [operates on a variety of types of data](/python/px-arguments/) and produces [easy-to-style figures](/python/styling-plotly-express/).

With `px.bar`, **each row of the DataFrame is represented as a rectangular mark**. To aggregate multiple data points into the same rectangular mark, please refer to the [histogram documentation](/python/histograms).
With `px.bar`, **each row of the DataFrame is represented as a rectangular mark**. To aggregate multiple data points into the same rectangular mark, please refer to the [histogram documentation](/python/histograms).

In the example below, there is only a single row of data per year, so a single bar is displayed per year.

Expand Down Expand Up @@ -152,7 +152,7 @@ fig.show()

### Aggregating into Single Colored Bars

As noted above `px.bar()` will result in **one rectangle drawn per row of input**. This can sometimes result in a striped look as in the examples above. To combine these rectangles into one per color per position, you can use `px.histogram()`, which has [its own detailed documentation page](/python/histogram).
As noted above `px.bar()` will result in **one rectangle drawn per row of input**. This can sometimes result in a striped look as in the examples above. To combine these rectangles into one per color per position, you can use `px.histogram()`, which has [its own detailed documentation page](/python/histogram).

> `px.bar` and `px.histogram` are designed to be nearly interchangeable in their call signatures, so as to be able to switch between aggregated and disaggregated bar representations.

Expand Down Expand Up @@ -304,7 +304,7 @@ fig.update_layout(barmode='stack')
fig.show()
```

### Stacked Bar Chart From Aggregating a DataFrame
### Stacked Bar Chart From Aggregating a DataFrame

Stacked bar charts are a powerful way to present results summarizing categories generated using the Pandas aggregate commands. `pandas.DataFrame.agg` produces a wide data set format incompatible with `px.bar`. Transposing and updating the indexes to achieve `px.bar` compatibility is a somewhat involved option. Here is one straightforward alternative, which presents the aggregated data as a stacked bar using plotly.graph_objects.

Expand All @@ -326,19 +326,19 @@ df_summarized["percent of world population"]=100*df_summarized["pop"]/df_summari
df_summarized["percent of world GDP"]=100*df_summarized["gdp"]/df_summarized["gdp"].sum()


df = df_summarized[["continent",
df = df_summarized[["continent",
"percent of world population",
"percent of world GDP",
]]

# We now have a wide data frame, but it's in the opposite orientation from the one that px is designed to deal with.
# Transposing it and rebuilding the indexes is an option, but iterating through the DF using graph objects is more succinct.
# Transposing it and rebuilding the indexes is an option, but iterating through the DF using graph objects is more succinct.

fig=go.Figure()
for category in df_summarized["continent"].values:
fig.add_trace(go.Bar(
x=df.columns[1:],
# We need to get a pandas series that contains just the values to graph;
# We need to get a pandas series that contains just the values to graph;
# We do so by selecting the right row, selecting the right columns
# and then transposing and using iloc to convert to a series
# Here, we assume that the bar element category variable is in column 0
Expand Down Expand Up @@ -619,9 +619,12 @@ fig.update_layout(
title='US Export of Plastic Scrap',
xaxis_tickfont_size=14,
yaxis=dict(
title='USD (millions)',
titlefont_size=16,
tickfont_size=14,
title=dict(
text="USD (millions)",
font=dict(
size=16
)
),
),
legend=dict(
x=0,
Expand Down
12 changes: 3 additions & 9 deletions doc/python/box-plots.md
Original file line number Diff line number Diff line change
Expand Up @@ -233,16 +233,10 @@ import plotly.graph_objects as go

fig = go.Figure()

fig.add_trace(go.Box(y=[
[ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ],
[ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ],
[ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ]
], name="Precompiled Quartiles"))

fig.update_traces(q1=[ 1, 2, 3 ], median=[ 4, 5, 6 ],
fig.add_trace(go.Box(q1=[ 1, 2, 3 ], median=[ 4, 5, 6 ],
q3=[ 7, 8, 9 ], lowerfence=[-1, 0, 1],
upperfence=[5, 6, 7], mean=[ 2.2, 2.8, 3.2 ],
sd=[ 0.2, 0.4, 0.6 ], notchspan=[ 0.2, 0.4, 0.6 ] )
upperfence=[7, 8, 9], mean=[ 2.2, 2.8, 3.2 ],
sd=[ 0.2, 0.4, 0.6 ], notchspan=[ 0.2, 0.4, 0.6 ], name="Precompiled Quartiles"))

fig.show()
```
Expand Down
5 changes: 3 additions & 2 deletions doc/python/carpet-contour.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,10 @@ fig.add_trace(go.Contourcarpet(
colorbar = dict(
y = 0,
yanchor = "bottom",
titleside = "right",
len = 0.75,
title = "Pressure coefficient, c<sub>p</sub>"
title = dict(
text="Pressure coefficient, c<sub>p</sub>",
side="right")
),
contours = dict(
start = -1,
Expand Down
Loading