Skip to content

Commit ca84936

Browse files
committed
update arrays and dtypes text
1 parent c5285b4 commit ca84936

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

doc/python/performance.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,17 +48,18 @@ In versions of Plotly.py prior to version 6, Plotly Express functions accepted n
4848

4949
*New in Plotly.py version 6*
5050

51-
You can improve the performance of generating Plotly figures that use a large number of data points by passing data as NumPy arrays, or in a format that Plotly can convert easily to NumPy arrays, such as Pandas and Polars Series or DataFrames. These formats will usually show better performance than passing data as a Python list.
51+
You can improve the performance of generating Plotly figures that use a large number of data points by passing data as NumPy arrays, or in a format that Plotly can convert easily to NumPy arrays, such as pandas and Polars Series or DataFrames. These formats will usually show better performance than passing data as a Python list.
5252

5353
Plotly.py uses Plotly.js for rendering, which supports typed arrays. In Plotly.py, NumPy arrays and NumPy-convertible arrays are base64 encoded before being passed to Plotly.js for rendering.
5454

5555
### Arrays and Data Types Supported
5656

57-
The following types of objects in Python are supported for improved performance:
57+
The following types of objects in Python are supported for base64 encoding for rendering with Plotly.js.
5858

59-
- Numpy `numpy.ndarray` objects.
60-
- Pandas Index, Pandas Series, Polars Series, and PyArrow Chunked Array objects.
61-
- Array objects that can be converted to `numpy.ndarray` objects. i.e., they implement `"__array__"` or `"__array_interface__"` and return a `numpy.ndarray`.
59+
- NumPy `numpy.ndarray` objects.
60+
- pandas Index, pandas Series, Polars Series, and PyArrow Chunked Array objects.
61+
- When working with Plotly Express, pandas DataFrame, Polars DataFrame and PyArrow DataFrame objects passed to the `data_frame` argument of `px` functions.
62+
- Array objects that can be converted to `numpy.ndarray` objects, i.e., they implement `"__array__"` or `"__array_interface__"` and return a `numpy.ndarray`.
6263

6364
The following [array data types](https://numpy.org/devdocs/reference/arrays.scalars.html) are supported:
6465

@@ -73,12 +74,15 @@ The following [array data types](https://numpy.org/devdocs/reference/arrays.scal
7374

7475
*If the array dtype is **int64** or **uint64**, often the default dtype for arrays in NumPy when no dtype is specified, those dtypes will be changed to other types internally by Plotly.py where possible. When working with NumPY directly, you can [specify the `dtype`](https://numpy.org/doc/stable/user/basics.types.html#array-types-and-conversions-between-types) when creating `ndarray` objects.
7576

77+
Arrays or data types that are not supported for base64 encoding to Plotly.js's typed arrays specification will still work and render correctly with Plotly. Those arrays and or data types just won't have the performance benefits that Plotly.js's base64 typed arrays feature provides.
78+
7679
### Unsupported Attributes
7780

78-
Arrays passed to attributes with the following names are not supported for the performance benefits:
81+
Arrays passed to attributes with the following names are not supported for base64 encoding for rendering with Plotly.js.
7982

8083
`geojson`, `layers`, and `range`.
8184

85+
Attributes that are not supported for base64 encoding to Plotly.js's typed arrays specification will still work and render correctly. Those attributes just won't have the performance benefits that Plotly.js's base64 typed arrays feature provides.
8286

8387
### Example with NumPy Arrays
8488

0 commit comments

Comments
 (0)