Arguments shared by the Plotly Express functions; see px_scatter() and the other
functions in the family.
Arguments
- data_frame
A data.frame, data.table, list or matrix. Needed for column names to be used in the other arguments; if
NULL, a data frame is built from the vectors given in the other arguments.- x
A column name in
data_frame, a vector of values, a one-sided formula evaluated indata_frame(e.g.~ log(pop)),px_constant()orpx_range(). Values from this column or vector are used to position marks along the x axis in cartesian coordinates.- y
A column name in
data_frame, a vector of values, a one-sided formula evaluated indata_frame(e.g.~ log(pop)),px_constant()orpx_range(). Values from this column or vector are used to position marks along the y axis in cartesian coordinates.- color
A column name in
data_frame, a vector of values, a one-sided formula evaluated indata_frame(e.g.~ log(pop)),px_constant()orpx_range(). Values from this column or vector are used to assign color to marks.- symbol
A column name in
data_frame, a vector of values, a one-sided formula evaluated indata_frame(e.g.~ log(pop)),px_constant()orpx_range(). Values from this column or vector are used to assign symbols to marks.- size
A column name in
data_frame, a vector of values, a one-sided formula evaluated indata_frame(e.g.~ log(pop)),px_constant()orpx_range(). Values from this column or vector are used to assign mark sizes.- hover_name
A column name in
data_frame, a vector of values, a one-sided formula evaluated indata_frame(e.g.~ log(pop)),px_constant()orpx_range(). Values from this column or vector appear in bold in the hover tooltip.- hover_data
Extra data to show in the hover tooltip: column names (a character vector or a formula such as
~c(a, b)), or a named list with column names as names and valuesTRUE(default formatting),FALSE(hide the column, e.g. one shown by default), a d3-format string such as":.3f", a vector of data, or a list of a format string orTRUEand a vector of data.- custom_data
Column names (a character vector or a formula such as
~c(a, b)), or a list of column names, formulas and vectors. Values from these columns are added to the traces'customdata(e.g. for use in Shiny events) without appearing in the hover tooltip.- text
A column name in
data_frame, a vector of values, a one-sided formula evaluated indata_frame(e.g.~ log(pop)),px_constant()orpx_range(). Values from this column or vector appear in the figure as text labels.- facet_row
A column name in
data_frame, a vector of values, a one-sided formula evaluated indata_frame(e.g.~ log(pop)),px_constant()orpx_range(). Values from this column or vector are used to assign marks to facetted subplots in the vertical direction.- facet_col
A column name in
data_frame, a vector of values, a one-sided formula evaluated indata_frame(e.g.~ log(pop)),px_constant()orpx_range(). Values from this column or vector are used to assign marks to facetted subplots in the horizontal direction.- facet_col_wrap
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
Spacing between facet rows, in paper units. Default is 0.03 or 0.07 when facet_col_wrap is used.
- facet_col_spacing
Spacing between facet columns, in paper units Default is 0.02.
- error_x
A column name in
data_frame, a vector of values, a one-sided formula evaluated indata_frame(e.g.~ log(pop)),px_constant()orpx_range(). Values from this column or vector are used to size x-axis error bars. Iferror_x_minusisNULL, error bars will be symmetrical, otherwiseerror_xis used for the positive direction only.- error_x_minus
A column name in
data_frame, a vector of values, a one-sided formula evaluated indata_frame(e.g.~ log(pop)),px_constant()orpx_range(). Values from this column or vector are used to size x-axis error bars in the negative direction. Ignored iferror_xisNULL.- error_y
A column name in
data_frame, a vector of values, a one-sided formula evaluated indata_frame(e.g.~ log(pop)),px_constant()orpx_range(). Values from this column or vector are used to size y-axis error bars. Iferror_y_minusisNULL, error bars will be symmetrical, otherwiseerror_yis used for the positive direction only.- error_y_minus
A column name in
data_frame, a vector of values, a one-sided formula evaluated indata_frame(e.g.~ log(pop)),px_constant()orpx_range(). Values from this column or vector are used to size y-axis error bars in the negative direction. Ignored iferror_yisNULL.- animation_frame
A column name in
data_frame, a vector of values, a one-sided formula evaluated indata_frame(e.g.~ log(pop)),px_constant()orpx_range(). Values from this column or vector are used to assign marks to animation frames.- animation_group
A column name in
data_frame, a vector of values, a one-sided formula evaluated indata_frame(e.g.~ log(pop)),px_constant()orpx_range(). Values from this column or vector are used to provide object-constancy across animation frames: rows with matchinganimation_groups will be treated as if they describe the same object in each frame.- category_orders
Named list mapping column names to the order of their values in axes, legends and facets, e.g.
list(day = c("Thur", "Fri", "Sat", "Sun")). By default values appear in the order first encountered, or in level order for factors.- labels
Named character vector or list mapping column names to the labels to use for axis titles, legend entries and hover text, e.g.
c(gdpPercap = "GDP per capita").- orientation
(default
"v"ifxandyare provided and both continuous or both categorical, otherwise"v"("h") ifx(y) is categorical andy(x) is continuous, otherwise"v"("h") if onlyx(y) is provided)- color_discrete_sequence
Character vector of colors, e.g.
px_colors$qualitative$Set1. Values ofcolorare assigned colors in order (cycling), unless set incolor_discrete_map. Defaults to the template'scolorway.- color_discrete_map
Named character vector or list mapping values of
colorto colors, overridingcolor_discrete_sequence. If the values ofcolorare colors,px_identity()(or"identity") uses them directly.- color_continuous_scale
Character vector of colors, e.g.
px_colors$sequential$Viridis, or the name of a scale in px_colors. Used whencoloris numeric. Defaults to the template's sequential colorscale.- range_color
If provided, overrides auto-scaling on the continuous color scale.
- color_continuous_midpoint
If set, computes the bounds of the continuous color scale to have the desired midpoint. Setting this value is recommended when using
plotly.express.colors.divergingcolor scales as the inputs tocolor_continuous_scale.- symbol_sequence
Strings should define valid plotly.js symbols. When
symbolis set, values in that column are assigned symbols by cycling throughsymbol_sequencein the order described incategory_orders, unless the value ofsymbolis a key insymbol_map.- symbol_map
Named character vector or list mapping values of
symbolto marker symbols, overridingsymbol_sequence.px_identity()uses the values ofsymboldirectly.- opacity
Value between 0 and 1. Sets the opacity for markers.
- size_max
Set the maximum mark size when using
size.- marginal_x
One of
"rug","box","violin", or"histogram". If set, a horizontal subplot is drawn above the main plot, visualizing the x-distribution.- marginal_y
One of
"rug","box","violin", or"histogram". If set, a vertical subplot is drawn to the right of the main plot, visualizing the y-distribution.- trendline
One of
"ols"(ordinary least squares regression),"lowess"(locally weighted smoothing),"rolling","expanding"or"ewm"(exponentially weighted moving average). A trendline is drawn for each discrete color/symbol group; configure it withtrendline_options. Fitted OLS models are available frompx_get_trendline_results().- trendline_options
Named list of options for the trendline function: for
"ols",add_constant,log_xandlog_y; for"lowess",frac; for"rolling",window,min_periods,centerandfunction("mean","median","sum","min","max","std","var","count"); for"expanding",min_periodsandfunction; for"ewm", one ofcom,span,halflifeoralpha, andadjust.- trendline_color_override
Valid CSS color. If provided, and if
trendlineis set, all trendlines will be drawn in this color rather than in the same color as the traces from which they draw their inputs.- trendline_scope
If
"trace", then one trendline is drawn per trace (i.e. per color, symbol, facet, animation frame etc) and if"overall"then one trendline is computed for the entire dataset, and replicated across all facets.- log_x
If
TRUE, the x-axis is log-scaled in cartesian coordinates.- log_y
If
TRUE, the y-axis is log-scaled in cartesian coordinates.- range_x
If provided, overrides auto-scaling on the x-axis in cartesian coordinates.
- range_y
If provided, overrides auto-scaling on the y-axis in cartesian coordinates.
- render_mode
One of
"auto","svg"or"webgl", default"auto"Controls the browser API used to draw marks."svg"is appropriate for figures of less than 1000 data points, and will allow for fully-vectorized output."webgl"is likely necessary for acceptable performance above 1000 points but rasterizes part of the output."auto"uses heuristics to choose the mode.- title
The figure title.
- subtitle
The figure subtitle.
- template
A template name (see
template_names()) or a template list. Defaults todefault_template().- width
The figure width in pixels.
- height
The figure height in pixels.
- z
A column name in
data_frame, a vector of values, a one-sided formula evaluated indata_frame(e.g.~ log(pop)),px_constant()orpx_range(). Values from this column or vector are used to position marks along the z axis in cartesian coordinates.- histfunc
One of
"count","sum","avg","min", or"max". Function used to aggregate values for summarization (note: can be normalized withhistnorm).- histnorm
One of
"percent","probability","density", or"probability density"IfNULL, the output ofhistfuncis used as is. If"probability", the output ofhistfuncfor a given bin is divided by the sum of the output ofhistfuncfor all bins. If"percent", the output ofhistfuncfor a given bin is divided by the sum of the output ofhistfuncfor all bins and multiplied by 100. If"density", the output ofhistfuncfor a given bin is divided by the size of the bin. If"probability density", the output ofhistfuncfor a given bin is normalized such that it corresponds to the probability that a random event whose distribution is described by the output ofhistfuncwill fall into that bin.- nbinsx
Positive integer. Sets the number of bins along the x axis.
- nbinsy
Positive integer. Sets the number of bins along the y axis.
- text_auto
If
TRUEor a string, the x or y or z values will be displayed as text, depending on the orientation A string like".2f"will be interpreted as atexttemplatenumeric formatting directive.- line_group
A column name in
data_frame, a vector of values, a one-sided formula evaluated indata_frame(e.g.~ log(pop)),px_constant()orpx_range(). Values from this column or vector are used to group rows ofdata_frameinto lines.- line_dash
A column name in
data_frame, a vector of values, a one-sided formula evaluated indata_frame(e.g.~ log(pop)),px_constant()orpx_range(). Values from this column or vector are used to assign dash-patterns to lines.- line_dash_sequence
Strings should define valid plotly.js dash-patterns. When
line_dashis set, values in that column are assigned dash-patterns by cycling throughline_dash_sequencein the order described incategory_orders, unless the value ofline_dashis a key inline_dash_map.- line_dash_map
Named character vector or list mapping values of
line_dashto dash patterns, overridingline_dash_sequence.px_identity()uses the values ofline_dashdirectly.- markers
If
TRUE, markers are shown on lines.- line_shape
One of
"linear","spline","hv","vh","hvh", or"vhv"- pattern_shape
A column name in
data_frame, a vector of values, a one-sided formula evaluated indata_frame(e.g.~ log(pop)),px_constant()orpx_range(). Values from this column or vector are used to assign pattern shapes to marks.- pattern_shape_sequence
Strings should define valid plotly.js patterns-shapes. When
pattern_shapeis set, values in that column are assigned patterns-shapes by cycling throughpattern_shape_sequencein the order described incategory_orders, unless the value ofpattern_shapeis a key inpattern_shape_map.- pattern_shape_map
Named character vector or list mapping values of
pattern_shapeto pattern shapes, overridingpattern_shape_sequence.px_identity()uses the values directly.- groupnorm
One of
"fraction"or"percent". If"fraction", the value of each point is divided by the sum of all values at that location coordinate."percent"is the same but multiplied by 100 to show percentages.NULLwill stack up all values at each location coordinate.- base
A column name in
data_frame, a vector of values, a one-sided formula evaluated indata_frame(e.g.~ log(pop)),px_constant()orpx_range(). Values from this column or vector are used to position the base of the bar.- barmode
One of
"group","overlay"or"relative"In"relative"mode, bars are stacked above zero for positive values and below zero for negative values. In"overlay"mode, bars are drawn on top of one another. In"group"mode, bars are placed beside each other.- x_start
A column name in
data_frame, a vector of values, a one-sided formula evaluated indata_frame(e.g.~ log(pop)),px_constant()orpx_range(). (required) Values from this column or vector are used to position marks along the x axis in cartesian coordinates.- x_end
A column name in
data_frame, a vector of values, a one-sided formula evaluated indata_frame(e.g.~ log(pop)),px_constant()orpx_range(). (required) Values from this column or vector are used to position marks along the x axis in cartesian coordinates.- marginal
One of
"rug","box","violin", or"histogram". If set, a subplot is drawn alongside the main plot, visualizing the distribution.- barnorm
One of
"fraction"or"percent". If"fraction", the value of each bar is divided by the sum of all values at that location coordinate."percent"is the same but multiplied by 100 to show percentages.NULLwill stack up all values at each location coordinate.- cumulative
If
TRUE, histogram values are cumulative.- nbins
Positive integer. Sets the number of bins.
- lines
If
FALSE, lines are not drawn (forced toTRUEifmarkersisFALSE).- ecdfnorm
One of
"probability"or"percent"IfNULL, values will be raw counts or sums. If"probability", values will be probabilities normalized from 0 to 1. If"percent", values will be percentages normalized from 0 to 100.- ecdfmode
One of
"standard","complementary"or"reversed"If"standard", the ECDF is plotted such that values represent data at or below the point. If"complementary", the CCDF is plotted such that values represent data above the point. If"reversed", a variant of the CCDF is plotted such that values represent data at or above the point.- violinmode
One of
"group"or"overlay"In"overlay"mode, violins are on drawn top of one another. In"group"mode, violins are placed beside each other.- points
One of
"outliers","suspectedoutliers","all", orFALSE. If"outliers", only the sample points lying outside the whiskers are shown. If"suspectedoutliers", all outlier points are shown and those less than 4Q1-3Q3 or greater than 4Q3-3Q1 are highlighted with the marker's"outliercolor". If"outliers", only the sample points lying outside the whiskers are shown. If"all", all sample points are shown. IfFALSE, no sample points are shown and the whiskers extend to the full range of the sample.- box
If
TRUE, boxes are drawn inside the violins.- boxmode
One of
"group"or"overlay"In"overlay"mode, boxes are on drawn top of one another. In"group"mode, boxes are placed beside each other.- notched
If
TRUE, boxes are drawn with notches.- stripmode
One of
"group"or"overlay"In"overlay"mode, strips are on drawn top of one another. In"group"mode, strips are placed beside each other.- error_z
A column name in
data_frame, a vector of values, a one-sided formula evaluated indata_frame(e.g.~ log(pop)),px_constant()orpx_range(). Values from this column or vector are used to size z-axis error bars. Iferror_z_minusisNULL, error bars will be symmetrical, otherwiseerror_zis used for the positive direction only.- error_z_minus
A column name in
data_frame, a vector of values, a one-sided formula evaluated indata_frame(e.g.~ log(pop)),px_constant()orpx_range(). Values from this column or vector are used to size z-axis error bars in the negative direction. Ignored iferror_zisNULL.- log_z
If
TRUE, the z-axis is log-scaled in cartesian coordinates.- range_z
If provided, overrides auto-scaling on the z-axis in cartesian coordinates.
- a
A column name in
data_frame, a vector of values, a one-sided formula evaluated indata_frame(e.g.~ log(pop)),px_constant()orpx_range(). Values from this column or vector are used to position marks along the a axis in ternary coordinates.- b
A column name in
data_frame, a vector of values, a one-sided formula evaluated indata_frame(e.g.~ log(pop)),px_constant()orpx_range(). Values from this column or vector are used to position marks along the b axis in ternary coordinates.- c
A column name in
data_frame, a vector of values, a one-sided formula evaluated indata_frame(e.g.~ log(pop)),px_constant()orpx_range(). Values from this column or vector are used to position marks along the c axis in ternary coordinates.- r
A column name in
data_frame, a vector of values, a one-sided formula evaluated indata_frame(e.g.~ log(pop)),px_constant()orpx_range(). Values from this column or vector are used to position marks along the radial axis in polar coordinates.- theta
A column name in
data_frame, a vector of values, a one-sided formula evaluated indata_frame(e.g.~ log(pop)),px_constant()orpx_range(). Values from this column or vector are used to position marks along the angular axis in polar coordinates.- direction
One of "
counterclockwise"or"clockwise". Default is"clockwise"Sets the direction in which increasing values of the angular axis are drawn.- start_angle
Sets start angle for the angular axis, with 0 being due east and 90 being due north.
- range_r
If provided, overrides auto-scaling on the radial axis in polar coordinates.
- range_theta
If provided, overrides auto-scaling on the angular axis in polar coordinates.
- log_r
If
TRUE, the radial axis is log-scaled in polar coordinates.- line_close
If
TRUE, an extra line segment is drawn between the first and last point.- lat
A column name in
data_frame, a vector of values, a one-sided formula evaluated indata_frame(e.g.~ log(pop)),px_constant()orpx_range(). Values from this column or vector are used to position marks according to latitude on a map.- lon
A column name in
data_frame, a vector of values, a one-sided formula evaluated indata_frame(e.g.~ log(pop)),px_constant()orpx_range(). Values from this column or vector are used to position marks according to longitude on a map.- locations
A column name in
data_frame, a vector of values, a one-sided formula evaluated indata_frame(e.g.~ log(pop)),px_constant()orpx_range(). Values from this column or vector are to be interpreted according tolocationmodeand mapped to longitude/latitude.- locationmode
One of "ISO-3", "USA-states", or 'country names' Determines the set of locations used to match entries in
locationsto regions on the map.- geojson
GeoJSON as a list (e.g. from
jsonlite::read_json()), with features whose ids are referenced bylocations.- featureidkey
Path to field in GeoJSON feature object with which to match the values passed in to
locations.The most common alternative to the default is of the form'properties.<key>.- projection
One of
"equirectangular","mercator","orthographic","natural earth","kavrayskiy7","miller","robinson","eckert4","azimuthal equal area","azimuthal equidistant","conic equal area","conic conformal","conic equidistant","gnomonic","stereographic","mollweide","hammer","transverse mercator","albers usa","winkel tripel","aitoff", or"sinusoidal"Default depends onscope.- scope
One of
"world","usa","europe","asia","africa","north america", or"south america"Default is"world"unlessprojectionis set to"albers usa", which forces"usa".- center
Dict keys are
"lat"and"lon"Sets the center point of the map.- fitbounds
One of
FALSE,locationsorgeojson.- basemap_visible
Force the basemap visibility.
- zoom
Between 0 and 20. Sets initial map zoom level. Higher values are more zoomed-in. If not provided, the map will select its own zoom level.
- map_style
Identifier of base map style. Allowed values are
"basic","carto-darkmatter","carto-darkmatter-nolabels","carto-positron","carto-positron-nolabels","carto-voyager","carto-voyager-nolabels","dark","light","open-street-map","outdoors","satellite","satellite-streets","streets","white-bg".- radius
Sets the radius of influence of each point.
- dimensions
Column names in
data_frame(a character vector or a formula such as~c(a, b)), or a list of column names, formulas and vectors. Values from these columns are used for multidimensional visualization.- dimensions_max_cardinality
When
dimensionsisNULLanddata_frameis provided, columns with more than this number of unique values are excluded from the output. Not used whendimensionsis passed.- names
A column name in
data_frame, a vector of values, a one-sided formula evaluated indata_frame(e.g.~ log(pop)),px_constant()orpx_range(). Values from this column or vector are used as labels for sectors.- values
A column name in
data_frame, a vector of values, a one-sided formula evaluated indata_frame(e.g.~ log(pop)),px_constant()orpx_range(). Values from this column or vector are used to set values associated to sectors.- hole
Number between 0 and 1: the fraction of the radius cut out of the pie to make a donut chart.
- parents
A column name in
data_frame, a vector of values, a one-sided formula evaluated indata_frame(e.g.~ log(pop)),px_constant()orpx_range(). Values from this column or vector are used as parents in sunburst and treemap charts.- path
Column names in
data_frame(a character vector or a formula such as~c(a, b)), or a list of column names, formulas and vectors. The columns define the hierarchy of sectors, from root to leaves. Cannot be combined withidsorparents.- ids
A column name in
data_frame, a vector of values, a one-sided formula evaluated indata_frame(e.g.~ log(pop)),px_constant()orpx_range(). Values from this column or vector are used to set ids of sectors- branchvalues
"total" or "remainder" Determines how the items in
valuesare summed. Whenset to "total", items invaluesare taken to be valueof all its descendants. When set to "remainder", itemsinvaluescorresponding to the root and the branches:sectors are taken to be the extra part not part of thesum of the values at their leaves.- maxdepth
Positive integer Sets the number of rendered sectors from any given
level. Setmaxdepthto -1 to render all thelevels in the hierarchy.