plotly.express
.scatter_3d¶
-
plotly.express.
scatter_3d
(data_frame=None, x=None, y=None, z=None, color=None, symbol=None, size=None, text=None, hover_name=None, hover_data=None, custom_data=None, error_x=None, error_x_minus=None, error_y=None, error_y_minus=None, error_z=None, error_z_minus=None, animation_frame=None, animation_group=None, category_orders=None, labels=None, size_max=None, color_discrete_sequence=None, color_discrete_map=None, color_continuous_scale=None, range_color=None, color_continuous_midpoint=None, symbol_sequence=None, symbol_map=None, opacity=None, log_x=False, log_y=False, log_z=False, range_x=None, range_y=None, range_z=None, title=None, template=None, width=None, height=None) → plotly.graph_objects._figure.Figure¶ In a 3D scatter plot, each row of
data_frame
is represented by a symbol mark in 3D space.- Parameters
data_frame (DataFrame or array-like or dict) – This argument needs to be passed for column names (and not keyword names) to be used. Array-like and dict are transformed internally to a pandas DataFrame. Optional: if missing, a DataFrame gets constructed under the hood using the other arguments.
x (str or int or Series or array-like) – Either a name of a column in
data_frame
, or a pandas Series or array_like object. Values from this column or array_like are used to position marks along the x axis in cartesian coordinates.y (str or int or Series or array-like) – Either a name of a column in
data_frame
, or a pandas Series or array_like object. Values from this column or array_like are used to position marks along the y axis in cartesian coordinates.z (str or int or Series or array-like) – Either a name of a column in
data_frame
, or a pandas Series or array_like object. Values from this column or array_like are used to position marks along the z axis in cartesian coordinates.color (str or int or Series or array-like) – Either a name of a column in
data_frame
, or a pandas Series or array_like object. Values from this column or array_like are used to assign color to marks.symbol (str or int or Series or array-like) – Either a name of a column in
data_frame
, or a pandas Series or array_like object. Values from this column or array_like are used to assign symbols to marks.size (str or int or Series or array-like) – Either a name of a column in
data_frame
, or a pandas Series or array_like object. Values from this column or array_like are used to assign mark sizes.text (str or int or Series or array-like) – Either a name of a column in
data_frame
, or a pandas Series or array_like object. Values from this column or array_like appear in the figure as text labels.hover_name (str or int or Series or array-like) – Either a name of a column in
data_frame
, or a pandas Series or array_like object. Values from this column or array_like appear in bold in the hover tooltip.hover_data (str, or list of str or int, or Series or array-like, or dict) – Either a name or list of names of columns in
data_frame
, or pandas Series, or array_like objects or a dict with column names as keys, with values True (for default formatting) False (in order to remove this column from hover information), or a formatting string, for example ‘:.3f’ or ‘|%a’ or list-like data to appear in the hover tooltip or tuples with a bool or formatting string as first element, and list-like data to appear in hover as second element Values from these columns appear as extra data in the hover tooltip.custom_data (str, or list of str or int, or Series or array-like) – Either name or list of names of columns in
data_frame
, or pandas Series, or array_like objects Values from these columns are extra data, to be used in widgets or Dash callbacks for example. This data is not user-visible but is included in events emitted by the figure (lasso selection etc.)error_x (str or int or Series or array-like) – Either a name of a column in
data_frame
, or a pandas Series or array_like object. Values from this column or array_like are used to size x-axis error bars. Iferror_x_minus
isNone
, error bars will be symmetrical, otherwiseerror_x
is used for the positive direction only.error_x_minus (str or int or Series or array-like) – Either a name of a column in
data_frame
, or a pandas Series or array_like object. Values from this column or array_like are used to size x-axis error bars in the negative direction. Ignored iferror_x
isNone
.error_y (str or int or Series or array-like) – Either a name of a column in
data_frame
, or a pandas Series or array_like object. Values from this column or array_like are used to size y-axis error bars. Iferror_y_minus
isNone
, error bars will be symmetrical, otherwiseerror_y
is used for the positive direction only.error_y_minus (str or int or Series or array-like) – Either a name of a column in
data_frame
, or a pandas Series or array_like object. Values from this column or array_like are used to size y-axis error bars in the negative direction. Ignored iferror_y
isNone
.error_z (str or int or Series or array-like) – Either a name of a column in
data_frame
, or a pandas Series or array_like object. Values from this column or array_like are used to size z-axis error bars. Iferror_z_minus
isNone
, error bars will be symmetrical, otherwiseerror_z
is used for the positive direction only.error_z_minus (str or int or Series or array-like) – Either a name of a column in
data_frame
, or a pandas Series or array_like object. Values from this column or array_like are used to size z-axis error bars in the negative direction. Ignored iferror_z
isNone
.animation_frame (str or int or Series or array-like) – Either a name of a column in
data_frame
, or a pandas Series or array_like object. Values from this column or array_like are used to assign marks to animation frames.animation_group (str or int or Series or array-like) – Either a name of a column in
data_frame
, or a pandas Series or array_like object. Values from this column or array_like are used to provide object-constancy across animation frames: rows with matching `animation_group`s will be treated as if they describe the same object in each frame.category_orders (dict with str keys and list of str values (default
{}
)) – By default, in Python 3.6+, the order of categorical values in axes, legends and facets depends on the order in which these values are first encountered indata_frame
(and no order is guaranteed by default in Python below 3.6). This parameter is used to force a specific ordering of values per column. The keys of this dict should correspond to column names, and the values should be lists of strings corresponding to the specific display order desired.labels (dict with str keys and str values (default
{}
)) – By default, column names are used in the figure for axis titles, legend entries and hovers. This parameter allows this to be overridden. The keys of this dict should correspond to column names, and the values should correspond to the desired label to be displayed.size_max (int (default
20
)) – Set the maximum mark size when usingsize
.color_discrete_sequence (list of str) – Strings should define valid CSS-colors. When
color
is set and the values in the corresponding column are not numeric, values in that column are assigned colors by cycling throughcolor_discrete_sequence
in the order described incategory_orders
, unless the value ofcolor
is a key incolor_discrete_map
. Various useful color sequences are available in theplotly.express.colors
submodules, specificallyplotly.express.colors.qualitative
.color_discrete_map (dict with str keys and str values (default
{}
)) – String values should define valid CSS-colors Used to overridecolor_discrete_sequence
to assign a specific colors to marks corresponding with specific values. Keys incolor_discrete_map
should be values in the column denoted bycolor
. Alternatively, if the values ofcolor
are valid colors, the string'identity'
may be passed to cause them to be used directly.color_continuous_scale (list of str) – Strings should define valid CSS-colors This list is used to build a continuous color scale when the column denoted by
color
contains numeric data. Various useful color scales are available in theplotly.express.colors
submodules, specificallyplotly.express.colors.sequential
,plotly.express.colors.diverging
andplotly.express.colors.cyclical
.range_color (list of two numbers) – If provided, overrides auto-scaling on the continuous color scale.
color_continuous_midpoint (number (default
None
)) – If set, computes the bounds of the continuous color scale to have the desired midpoint. Setting this value is recommended when usingplotly.express.colors.diverging
color scales as the inputs tocolor_continuous_scale
.symbol_sequence (list of str) – Strings should define valid plotly.js symbols. When
symbol
is set, values in that column are assigned symbols by cycling throughsymbol_sequence
in the order described incategory_orders
, unless the value ofsymbol
is a key insymbol_map
.symbol_map (dict with str keys and str values (default
{}
)) – String values should define plotly.js symbols Used to overridesymbol_sequence
to assign a specific symbols to marks corresponding with specific values. Keys insymbol_map
should be values in the column denoted bysymbol
. Alternatively, if the values ofsymbol
are valid symbol names, the string'identity'
may be passed to cause them to be used directly.opacity (float) – Value between 0 and 1. Sets the opacity for markers.
log_x (boolean (default
False
)) – IfTrue
, the x-axis is log-scaled in cartesian coordinates.log_y (boolean (default
False
)) – IfTrue
, the y-axis is log-scaled in cartesian coordinates.log_z (boolean (default
False
)) – IfTrue
, the z-axis is log-scaled in cartesian coordinates.range_x (list of two numbers) – If provided, overrides auto-scaling on the x-axis in cartesian coordinates.
range_y (list of two numbers) – If provided, overrides auto-scaling on the y-axis in cartesian coordinates.
range_z (list of two numbers) – If provided, overrides auto-scaling on the z-axis in cartesian coordinates.
title (str) – The figure title.
template (str or dict or plotly.graph_objects.layout.Template instance) – The figure template name (must be a key in plotly.io.templates) or definition.
width (int (default
None
)) – The figure width in pixels.height (int (default
None
)) – The figure height in pixels.
- Returns
- Return type