You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/python/performance.md
+10-6Lines changed: 10 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -48,17 +48,18 @@ In versions of Plotly.py prior to version 6, Plotly Express functions accepted n
48
48
49
49
*New in Plotly.py version 6*
50
50
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.
52
52
53
53
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.
54
54
55
55
### Arrays and Data Types Supported
56
56
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.
- Array objects that can be converted to `numpy.ndarray` objects. i.e., they implement `"__array__"` or `"__array_interface__"` and return a `numpy.ndarray`.
- 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`.
62
63
63
64
The following [array data types](https://numpy.org/devdocs/reference/arrays.scalars.html) are supported:
64
65
@@ -73,12 +74,15 @@ The following [array data types](https://numpy.org/devdocs/reference/arrays.scal
73
74
74
75
*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.
75
76
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
+
76
79
### Unsupported Attributes
77
80
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.
79
82
80
83
`geojson`, `layers`, and `range`.
81
84
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.
0 commit comments