plotly.express.box¶
-
plotly.express.box(data_frame=None, x=None, y=None, color=None, facet_row=None, facet_col=None, facet_col_wrap=0, facet_row_spacing=None, facet_col_spacing=None, hover_name=None, hover_data=None, custom_data=None, animation_frame=None, animation_group=None, category_orders=None, labels=None, color_discrete_sequence=None, color_discrete_map=None, orientation=None, boxmode=None, log_x=False, log_y=False, range_x=None, range_y=None, points=None, notched=False, title=None, subtitle=None, template=None, width=None, height=None) → plotly.graph_objects._figure.Figure¶ In a box plot, rows of
data_frameare grouped together into a box-and-whisker mark to visualize their distribution.Each box spans from quartile 1 (Q1) to quartile 3 (Q3). The second quartile (Q2) is marked by a line inside the box. By default, the whiskers correspond to the box’ edges +/- 1.5 times the interquartile range (IQR: Q3-Q1), see “points” for other options.
- 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. Eitherxorycan optionally be a list of column references or array_likes, in which case the data will be treated as if it were ‘wide’ rather than ‘long’.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. Eitherxorycan optionally be a list of column references or array_likes, in which case the data will be treated as if it were ‘wide’ rather than ‘long’.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.facet_row (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 facetted subplots in the vertical direction.facet_col (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 facetted subplots in the horizontal direction.facet_col_wrap (int) – Maximum number of facet columns. Wraps the column variable at this width, so that the column facets span multiple rows. Ignored if 0, and forced to 0 if
facet_rowor amarginalis set.facet_row_spacing (float between 0 and 1) – Spacing between facet rows, in paper units. Default is 0.03 or 0.07 when facet_col_wrap is used.
facet_col_spacing (float between 0 and 1) – Spacing between facet columns, in paper units Default is 0.02.
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
