Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
40b9af1
WIP accelerated encoding with orjson
jonmmease Dec 5, 2020
f79e318
support fig to dict in io without cloning
jonmmease Dec 5, 2020
55720de
Merge branch 'master' into orjson_encoding
jonmmease Dec 5, 2020
7b3593a
fix clone default
jonmmease Dec 5, 2020
da915d6
Add pio.json.config object to configure default encoder
jonmmease Dec 5, 2020
7b235ef
default_encoder to default_engine
jonmmease Dec 5, 2020
7895b6a
blacken
jonmmease Dec 5, 2020
ce05a68
Handle Dash objects in to_json
jonmmease Dec 6, 2020
4ef6510
add JSON encoding tests
jonmmease Dec 31, 2020
101ba85
add testing of from_plotly_json
jonmmease Dec 31, 2020
67d3670
Better error message when orjson not installed and orjson engine requ…
jonmmease Dec 31, 2020
02c00da
Add orjson as optional testing dependency
jonmmease Dec 31, 2020
99ea6a1
Replace Python 3.5 CI tests with 3.8
jonmmease Dec 31, 2020
d44ec26
Try only install orjson with Python 3.6+
jonmmease Dec 31, 2020
b7d8422
Don't test orjson engine when orjson not installed
jonmmease Dec 31, 2020
ddcd6f5
Try new 3.8.7 docker image since prior guess doesn't exist
jonmmease Dec 31, 2020
33359f3
greater than!
jonmmease Dec 31, 2020
c7c1819
Bump scikit image version for Python 3.8 compatibility
jonmmease Dec 31, 2020
a8d52ab
Try to help Python 2 from getting confused about which json module to…
jonmmease Dec 31, 2020
619838f
Update pandas for Python 3
jonmmease Dec 31, 2020
7c7a272
Revert 3.8 CI updates. Too much for this PR
jonmmease Dec 31, 2020
1708703
Doh
jonmmease Dec 31, 2020
66cab10
Don't skip copying during serialization
jonmmease Dec 31, 2020
56a8945
Rename new JSON functions:
jonmmease Jan 2, 2021
0a51020
Ensure cleaned numpy arrays are contiguous
jonmmease Jan 2, 2021
4e9d64e
Use to_json_plotly in html and orca logic
jonmmease Jan 8, 2021
d4068de
Add orjson documentation dependency
jonmmease Jan 8, 2021
58b7192
Handle pandas Timestamp scalars in orjson engine
jonmmease Jan 8, 2021
974fcba
Rework date and string encoding, add and fix tests
jonmmease Jan 8, 2021
a651a63
default JSON engine to "auto"
jonmmease Jan 8, 2021
af1d88d
Fix expected JSON in html export (no spaces)
jonmmease Jan 8, 2021
1d6acc3
Merge remote-tracking branch 'origin/master' into orjson_encoding
jonmmease Jan 8, 2021
d51fd94
blacken
jonmmease Jan 8, 2021
042c54c
Fix expected JSON in matplotlylib test
jonmmease Jan 8, 2021
ddc1b8f
Fix expected JSON in html repr test
jonmmease Jan 8, 2021
d7928b0
Merge remote-tracking branch 'origin/master' into orjson_encoding
jonmmease Jan 13, 2021
76cc625
Don't drop timezones during serialization, just let Plotly.js ignore …
jonmmease Jan 13, 2021
453461d
Merge branch 'numpy_date_serialization' into orjson_encoding
jonmmease Jan 13, 2021
84ba4b5
no need to skip legacy tests now
jonmmease Jan 13, 2021
340aed3
Only try `datetime_as_string` on datetime kinded numpy arrays
jonmmease Jan 13, 2021
6cea61d
Don't store object or unicode numpy arrays in figure. Coerce to lists
jonmmease Jan 21, 2021
93815c1
Try orjson encoding without cleaning first
jonmmease Jan 21, 2021
242d1fa
Merge remote-tracking branch 'origin/master' into orjson_encoding
jonmmease Jan 21, 2021
8a3a4b3
blacken
jonmmease Jan 21, 2021
1de750a
remove scratch file
jonmmease Jan 21, 2021
81f73d5
Remove unused clone
jonmmease Jan 21, 2021
80be8bd
Remove the new "json" encoder
jonmmease Jan 22, 2021
cb54f88
Reorder dict cleaning for performance
jonmmease Jan 22, 2021
1fbfa0d
Merge remote-tracking branch 'origin/master' into orjson_encoding
jonmmease Apr 29, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Merge remote-tracking branch 'origin/master' into orjson_encoding
# Conflicts:
#	packages/python/plotly/plotly/io/_json.py
#	packages/python/plotly/tox.ini
  • Loading branch information
jonmmease committed Apr 29, 2021
commit 1fbfa0d36cb3ccba737f3e1beedb52be1742c042
418 changes: 151 additions & 267 deletions .circleci/config.yml

Large diffs are not rendered by default.

23 changes: 0 additions & 23 deletions .circleci/create_conda_optional_env.sh

This file was deleted.

15 changes: 0 additions & 15 deletions .circleci/install_miniconda_and_build_.sh

This file was deleted.

18 changes: 9 additions & 9 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
faster image rendering and smaller figure size. Additional optional arguments
`binary_backend`, `binary_format` and `binary_compression_level` control
how to generate the b64 string ([#2691](https://github.com/plotly/plotly.py/pull/2691)
- `px.imshow` has a new `constrast_rescaling` argument in order to choose how
- `px.imshow` has a new `contrast_rescaling` argument in order to choose how
to set data values corresponding to the bounds of the color range
([#2691](https://github.com/plotly/plotly.py/pull/2691)

Expand Down Expand Up @@ -239,7 +239,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).

### Added

- The `hover_data` parameter of `px` functions can now be a dictionary. This makes it possible to skip hover information for some arguments or to change the formatting of hover informatiom [#2377](https://github.com/plotly/plotly.py/pull/2377).
- The `hover_data` parameter of `px` functions can now be a dictionary. This makes it possible to skip hover information for some arguments or to change the formatting of hover information [#2377](https://github.com/plotly/plotly.py/pull/2377).
- It's now possible to build a development version of Plotly.py against the build artifacts from a non-`master` branch of Plotly.js, which makes for faster QA and development cycles [#2349](https://github.com/plotly/plotly.py/pull/2349). Thanks [@zouhairm](https://github.com/zouhairm) for this Pull Request!

### Fixed
Expand All @@ -252,7 +252,7 @@ This version includes several performance improvements ([#2368](https://github.c

- 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.
- Property validation is now disabled for select internal operations.
- 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.
- When used with Python 3.7 and above, plotly.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.

## [4.6.0] - 2020-03-31

Expand Down Expand Up @@ -290,7 +290,7 @@ This version includes several performance improvements ([#2368](https://github.c

- Jupyterlab extension now compatible with both Jupyterlab 1.2 and 2.0 [#2261](https://github.com/plotly/plotly.py/pull/2261) with thanks to [@consideRatio](https://github.com/consideRatio) for the contribution!
- Fixed a bug when using boolean values for the color argument of px functions [#2127](https://github.com/plotly/plotly.py/pull/2127)
- Corrected import bug which was occuring with old versions of ipywidgets [#2265](https://github.com/plotly/plotly.py/pull/2265)
- Corrected import bug which was occurring with old versions of ipywidgets [#2265](https://github.com/plotly/plotly.py/pull/2265)
- Fixed python 3.8 syntax warning [#2262](https://github.com/plotly/plotly.py/pull/2262), with thanks to [@sgn](https://github.com/sgn) for the contribution!

## [4.5.3] - 2020-03-05
Expand Down Expand Up @@ -365,7 +365,7 @@ This version includes several performance improvements ([#2368](https://github.c
for more information
- The tutorials of the [plotly.py documentation](https://plot.ly/python/) are
now in the main [plotly.py Github repository](https://github.com/plotly/plotly.py). Contributions in order to improve or extend the documentation are very welcome!
- `plotly.express` generated plots no longer have a default height of 600 pixels, instead they inherit the default height of regular figures [#1990](https://github.com/plotly/plotly.py/pull/1990). To restore the old behavior, set `px.defaults.height=600` once per session, or set the `height` keyword arguement to any `px.function()` to 600.
- `plotly.express` generated plots no longer have a default height of 600 pixels, instead they inherit the default height of regular figures [#1990](https://github.com/plotly/plotly.py/pull/1990). To restore the old behavior, set `px.defaults.height=600` once per session, or set the `height` keyword argument to any `px.function()` to 600.

### Fixed

Expand Down Expand Up @@ -439,7 +439,7 @@ section [#1969](https://github.com/plotly/plotly.py/pull/1969).
- The width of a figure produced by the `create_gantt` figure factory now resizes responsively ([#1724](https://github.com/plotly/plotly.py/pull/1724))

### Fixed
- The name of the steps property of `graph_objects.indicator.Guage` has been renamed from `stepss` to `steps`
- The name of the steps property of `graph_objects.indicator.Gauge` has been renamed from `stepss` to `steps`
- Avoid crash in iframe renderers when running outside iPython ([#1723](https://github.com/plotly/plotly.py/pull/1723))

## [4.1.0] - 2019-08-06
Expand Down Expand Up @@ -491,7 +491,7 @@ This is a major release that includes many new features, and a few breaking chan
- Added support for all trace types in `make_subplots` ([#1528](https://github.com/plotly/plotly.py/pull/1528))
- Added support for secondary y-axes in `make_subplots` ([#1564](https://github.com/plotly/plotly.py/pull/1564))
- Support passing a scalar trace object (rather than a list or tuple of trace objects) as the `data` property to the `Figure` constructor ([#1614](https://github.com/plotly/plotly.py/pull/1614))
- Added dictionary-stule `.pop` method to graph object classes ([#1614](https://github.com/plotly/plotly.py/pull/1614))
- Added dictionary-style `.pop` method to graph object classes ([#1614](https://github.com/plotly/plotly.py/pull/1614))
- New `jupyterlab-plotly` JupyterLab extension for rendering figures in JupyterLab. Replaces the `@jupyterlab/plotly-extension` extension, and includes JupyterLab 1.0 support.
- Added new suite of built-in colorscales to the `plotly.colors` module, and support for specifying this wide range of colorscales by name. Also added support for specifying colorscales as a list of colors, in which case the color spacing is assumed to be uniform ([#1647](https://github.com/plotly/plotly.py/pull/1647)).
- Added `sphinx-gallery` renderer for embedding plotly figures in [Sphinx-Gallery](https://sphinx-gallery.github.io/) ([#1577](https://github.com/plotly/plotly.py/pull/1577), [plotly/plotly-sphinx-gallery](https://github.com/plotly/plotly-sphinx-gallery)).
Expand Down Expand Up @@ -1096,7 +1096,7 @@ must be installed:
properties are ignored rather than causing an exception.
- A `to_ordered_dict` method has been added to the `Figure` and `FigureWidget`
classes. This method returns a representation of the figure as a nested
structure of `OrdererdDict` and `list` instances where the keys in each
structure of `OrderedDict` and `list` instances where the keys in each
`OrderedDict` are sorted alphabetically. This method replaces the
`get_ordered` method that was available in version 2, and makes it possible
to traverse the nested structure of a figure in a deterministic order.
Expand Down Expand Up @@ -1517,7 +1517,7 @@ gone.
## [1.12.10] - 2016-11-28
### Updated
- `FF.create_violin` and `FF.create_scatterplotmatrix` now by default do not print subplot grid information in output
- Removed alert that occured when downloading plot images offline. Please note: for higher resolution images and more export options, consider making requests to our image servers. See: `help(py.image)` for more details.
- Removed alert that occurred when downloading plot images offline. Please note: for higher resolution images and more export options, consider making requests to our image servers. See: `help(py.image)` for more details.

### Added
- Plot configuration options for offline plots. See the list of [configuration options](https://github.com/Rikorose/plotly.py/blob/master/plotly/offline/offline.py#L189) and [examples](https://plot.ly/javascript/configuration-options/) for more information.
Expand Down
2 changes: 1 addition & 1 deletion build_for_conda.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ Finally, build and test the created version:

`conda build plotly`

Currently, the updated (version 1.12.4) conda package sits at https://anaconda.org/chohner/plotly. There seems to be an old offial package at https://anaconda.org/plotly/plotly.
Currently, the updated (version 1.12.4) conda package sits at https://anaconda.org/chohner/plotly. There seems to be an old official package at https://anaconda.org/plotly/plotly.
2 changes: 1 addition & 1 deletion doc/python/2D-Histogram.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ fig = go.Figure(go.Histogram2d(x=x, y=y, histnorm='probability',
fig.show()
```
### Sharing bin settings between 2D Histograms
This example shows how to use [bingroup](https://plotly.com/python/reference/histogram/#histogram-bingroup) attribute to have a compatible bin settings for both histograms. To define `start`, `end` and `size` value of x-axis and y-axis seperatly, set [ybins](https://plotly.com/python/reference/histogram2dcontour/#histogram2dcontour-ybins) and `xbins`.
This example shows how to use [bingroup](https://plotly.com/python/reference/histogram/#histogram-bingroup) attribute to have a compatible bin settings for both histograms. To define `start`, `end` and `size` value of x-axis and y-axis separately, set [ybins](https://plotly.com/python/reference/histogram2dcontour/#histogram2dcontour-ybins) and `xbins`.

```python
import plotly.graph_objects as go
Expand Down
4 changes: 2 additions & 2 deletions doc/python/3d-isosurface-plots.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ fig = go.Figure(data=go.Isosurface(
fig.show()
```

#### Isosurface with Addtional Slices
#### Isosurface with Additional Slices

Here we visualize slices parallel to the axes on top of isosurfaces. For a clearer visualization, the `fill` ratio of isosurfaces is decreased below 1 (completely filled).

Expand Down Expand Up @@ -235,4 +235,4 @@ fig.show()
```

#### Reference
See https://plotly.com/python/reference/isosurface/ for more information and chart attribute options!
See https://plotly.com/python/reference/isosurface/ for more information and chart attribute options!
2 changes: 1 addition & 1 deletion doc/python/3d-mesh.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ IFrame(snippet_url + '3d-mesh', width='100%', height=630)

### Mesh Tetrahedron

In this example we use the `ì`, `j` and `k` parameters to specify manually the geometry of the triangles of the mesh.
In this example we use the `i`, `j` and `k` parameters to specify manually the geometry of the triangles of the mesh.

```python
import plotly.graph_objects as go
Expand Down
68 changes: 68 additions & 0 deletions doc/python/LaTeX.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
---
jupyter:
jupytext:
notebook_metadata_filter: all
text_representation:
extension: .md
format_name: markdown
format_version: '1.2'
jupytext_version: 1.4.2
kernelspec:
display_name: Python 3
language: python
name: python3
language_info:
codemirror_mode:
name: ipython
version: 3
file_extension: .py
mimetype: text/x-python
name: python
nbconvert_exporter: python
pygments_lexer: ipython3
version: 3.7.7
plotly:
description: How to add LaTeX to python graphs.
display_as: advanced_opt
language: python
layout: base
name: LaTeX
order: 5
page_type: example_index
permalink: python/LaTeX/
thumbnail: thumbnail/latex.jpg
---

#### LaTeX Typesetting

```python
import plotly.express as px

fig = px.line(x=[1, 2, 3, 4], y=[1, 4, 9, 16], title=r'$\alpha_{1c} = 352 \pm 11 \text{ km s}^{-1}$')
fig.update_layout(
xaxis_title=r'$\sqrt{(n_\text{c}(t|{T_\text{early}}))}$',
yaxis_title=r'$d, r \text{ (solar radius)}$'
)
fig.show()
```

```python
import plotly.graph_objs as go

fig = go.Figure()
fig.add_trace(go.Scatter(
x=[1, 2, 3, 4],
y=[1, 4, 9, 16],
name=r'$\alpha_{1c} = 352 \pm 11 \text{ km s}^{-1}$'
))
fig.add_trace(go.Scatter(
x=[1, 2, 3, 4],
y=[0.5, 2, 4.5, 8],
name=r'$\beta_{1c} = 25 \pm 11 \text{ km s}^{-1}$'
))
fig.update_layout(
xaxis_title=r'$\sqrt{(n_\text{c}(t|{T_\text{early}}))}$',
yaxis_title=r'$d, r \text{ (solar radius)}$'
)
fig.show()
```
4 changes: 2 additions & 2 deletions doc/python/annotated-heatmap.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ fig.show()
```

#### Custom Text and X & Y Labels
set `annotation_text` to a matrix with the same dimmensions as `z`
set `annotation_text` to a matrix with the same dimensions as `z`

```python
import plotly.figure_factory as ff
Expand Down Expand Up @@ -203,4 +203,4 @@ fig.show()

#### Reference

For more info on Plotly heatmaps, see: https://plotly.com/python/reference/heatmap/.<br> For more info on using colorscales with Plotly see: https://plotly.com/python/heatmap-and-contour-colorscales/ <br>For more info on `ff.create_annotated_heatmap()`, see the [full function reference](https://plotly.com/python-api-reference/generated/plotly.figure_factory.create_annotated_heatmap.html#plotly.figure_factory.create_annotated_heatmap)
For more info on Plotly heatmaps, see: https://plotly.com/python/reference/heatmap/.<br> For more info on using colorscales with Plotly see: https://plotly.com/python/heatmap-and-contour-colorscales/ <br>For more info on `ff.create_annotated_heatmap()`, see the [full function reference](https://plotly.com/python-api-reference/generated/plotly.figure_factory.create_annotated_heatmap.html#plotly.figure_factory.create_annotated_heatmap)
4 changes: 2 additions & 2 deletions doc/python/axes.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ The axis type is auto-detected by looking at data from the first [trace](/python

### Forcing an axis to be categorical

It is possible to force the axis type by setting explicitely `xaxis_type`. In the example below the automatic X axis type would be `linear` (because there are not more than twice as many unique strings as unique numbers) but we force it to be `category`.
It is possible to force the axis type by setting explicitly `xaxis_type`. In the example below the automatic X axis type would be `linear` (because there are not more than twice as many unique strings as unique numbers) but we force it to be `category`.

```python
import plotly.express as px
Expand Down Expand Up @@ -139,7 +139,7 @@ IFrame(snippet_url + 'axes', width='100%', height=630)

#### Moving Tick Labels Inside the Plot

The `ticklabelposition` attribute moves tick labels inside the plotting area, and modifies the auto-range behaviour to accomodate the labels.
The `ticklabelposition` attribute moves tick labels inside the plotting area, and modifies the auto-range behaviour to accommodate the labels.

```python
import plotly.express as px
Expand Down
2 changes: 1 addition & 1 deletion doc/python/builtin-colorscales.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jupyter:
version: 3.7.6
plotly:
description: A reference for the built-in named continuous (sequential, diverging
and cylclical) color scales in Plotly.
and cyclical) color scales in Plotly.
display_as: file_settings
has_thumbnail: true
ipynb: ~notebook_demo/187
Expand Down
4 changes: 2 additions & 2 deletions doc/python/carpet-contour.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jupyter:

### Basic Carpet Plot

Set the `x` and `y` coorindates, using `x` and `y` attributes. If `x` coorindate values are ommitted a cheater plot will be created. To save parameter values use `a` and `b` attributes. To make changes to the axes, use `aaxis` or `baxis` attributes. For a more detailed list of axes attributes refer to [python reference](https://plotly.com/python/reference/carpet/#carpet-aaxis).
Set the `x` and `y` coordinates, using `x` and `y` attributes. If `x` coordinate values are omitted a cheater plot will be created. To save parameter values use `a` and `b` attributes. To make changes to the axes, use `aaxis` or `baxis` attributes. For a more detailed list of axes attributes refer to [python reference](https://plotly.com/python/reference/carpet/#carpet-aaxis).

```python
import plotly.graph_objects as go
Expand Down Expand Up @@ -286,4 +286,4 @@ fig.show()

### Reference

See https://plotly.com/python/reference/contourcarpet/ for more information and chart attribute options!
See https://plotly.com/python/reference/contourcarpet/ for more information and chart attribute options!
4 changes: 2 additions & 2 deletions doc/python/carpet-plot.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jupyter:
### Set X and Y Coordinates


To set the `x` and `y` coordinates use `x` and `y` attributes. If `x` coordindate values are ommitted a cheater plot will be created. The plot below has a `y` array specified but requires `a` and `b` parameter values before an axis may be plotted.
To set the `x` and `y` coordinates use `x` and `y` attributes. If `x` coordinate values are omitted a cheater plot will be created. The plot below has a `y` array specified but requires `a` and `b` parameter values before an axis may be plotted.
<!-- #endregion -->

```python
Expand Down Expand Up @@ -189,4 +189,4 @@ To add points and lines see [Carpet Scatter Plots](https://plotly.com/python/car

### Reference

See https://plotly.com/python/reference/carpet/ for more information and chart attribute options!
See https://plotly.com/python/reference/carpet/ for more information and chart attribute options!
4 changes: 2 additions & 2 deletions doc/python/categorical-axes.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ This page shows examples of how to configure [2-dimensional Cartesian axes](/pyt

The different types of Cartesian axes are configured via the `xaxis.type` or `yaxis.type` attribute, which can take on the following values:

- `'linear'` (see the [linear axes tutoria](/python/axes/))
- `'linear'` (see the [linear axes tutorial](/python/axes/))
- `'log'` (see the [log plot tutorial](/python/log-plots/))
- `'date'` (see the [tutorial on timeseries](/python/time-series/))
- `'category'` see below
Expand All @@ -55,7 +55,7 @@ The axis type is auto-detected by looking at data from the first [trace](/python

### Forcing an axis to be categorical

It is possible to force the axis type by setting explicitely `xaxis_type`. In the example below the automatic X axis type would be `linear` (because there are not more than twice as many unique strings as unique numbers) but we force it to be `category`.
It is possible to force the axis type by setting explicitly `xaxis_type`. In the example below the automatic X axis type would be `linear` (because there are not more than twice as many unique strings as unique numbers) but we force it to be `category`.

```python
import plotly.express as px
Expand Down
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.