pub struct Layout<'a> { /* private fields */ }
Implementations§
Source§impl<'a> Layout<'a>
impl<'a> Layout<'a>
Sourcepub fn font(&mut self) -> &mut Font<'a>
pub fn font(&mut self) -> &mut Font<'a>
Sets the global font. Note that fonts used in traces and other layout components inherit from the global font.
pub fn title(&mut self) -> &mut Title<'a>
pub fn uniformtext(&mut self) -> &mut Uniformtext
Sourcepub fn autosize(&mut self, autosize: bool) -> &mut Self
pub fn autosize(&mut self, autosize: bool) -> &mut Self
Determines whether or not a layout width or height that has been left undefined by the user is initialized on each relayout. Note that, regardless of this attribute, an undefined layout width or height is always initialized on the first call to plot.
default: false
Sourcepub fn height(&mut self, height: f64) -> &mut Self
pub fn height(&mut self, height: f64) -> &mut Self
Sets the plot’s height (in px).
default: 450
pub fn margin(&mut self) -> &mut Margin
Sourcepub fn paper_bgcolor(&mut self, paper_bgcolor: &'a str) -> &mut Self
pub fn paper_bgcolor(&mut self, paper_bgcolor: &'a str) -> &mut Self
Sets the background color of the paper where the graph is drawn.
default: #fff
Sourcepub fn plot_bgcolor(&mut self, plot_bgcolor: &'a str) -> &mut Self
pub fn plot_bgcolor(&mut self, plot_bgcolor: &'a str) -> &mut Self
Sets the background color of the plotting area in-between x and y axes.
default: #fff
Sourcepub fn separators(&mut self, separators: &'a str) -> &mut Self
pub fn separators(&mut self, separators: &'a str) -> &mut Self
Sets the decimal and thousand separators. For example, *. * puts a ‘.’ before decimals and a space between thousands. In English locales, dflt is ., but other locales may alter this default.
Sourcepub fn hidesources(&mut self, hidesources: bool) -> &mut Self
pub fn hidesources(&mut self, hidesources: bool) -> &mut Self
Determines whether or not a text link citing the data source is placed at the bottom-right cored of the figure. Has only an effect only on graphs that have been generated via forked graphs from the Chart Studio Cloud (at https://chart-studio.plotly.com or on-premise).
default: false
Sourcepub fn showlegend(&mut self, showlegend: bool) -> &mut Self
pub fn showlegend(&mut self, showlegend: bool) -> &mut Self
Determines whether or not a legend is drawn. Default is true
if there is a trace to show and any of these: a) Two or more traces would by default be shown in the legend. b) One pie trace is shown in the legend. c) One trace is explicitly given with showlegend: true
.
Sourcepub fn colorway(&mut self, colorway: &'a [&'a str]) -> &mut Self
pub fn colorway(&mut self, colorway: &'a [&'a str]) -> &mut Self
Sets the default trace colors.
default: ["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"]
Sourcepub fn datarevision(&mut self, datarevision: Any) -> &mut Self
pub fn datarevision(&mut self, datarevision: Any) -> &mut Self
If provided, a changed value tells Plotly.react
that one or more data arrays has changed. This way you can modify arrays in-place rather than making a complete new copy for an incremental change. If NOT provided, Plotly.react
assumes that data arrays are being treated as immutable, thus any data array with a different identity from its predecessor contains new data.
Sourcepub fn uirevision(&mut self, uirevision: Any) -> &mut Self
pub fn uirevision(&mut self, uirevision: Any) -> &mut Self
Used to allow user interactions with the plot to persist after Plotly.react
calls that are unaware of these interactions. If uirevision
is omitted, or if it is given and it changed from the previous Plotly.react
call, the exact new figure is used. If uirevision
is truthy and did NOT change, any attribute that has been affected by user interactions and did not receive a different value in the new figure will keep the interaction value. layout.uirevision
attribute serves as the default for uirevision
attributes in various sub-containers. For finer control you can set these sub-attributes directly. For example, if your app separately controls the data on the x and y axes you might set xaxis.uirevision=*time*
and yaxis.uirevision=*cost*
. Then if only the y data is changed, you can update yaxis.uirevision=*quantity*
and the y axis range will reset but the x axis range will retain any user-driven zoom.
Sourcepub fn editrevision(&mut self, editrevision: Any) -> &mut Self
pub fn editrevision(&mut self, editrevision: Any) -> &mut Self
Controls persistence of user-driven changes in editable: true
configuration, other than trace names and axis titles. Defaults to layout.uirevision
.
Sourcepub fn selectionrevision(&mut self, selectionrevision: Any) -> &mut Self
pub fn selectionrevision(&mut self, selectionrevision: Any) -> &mut Self
Controls persistence of user-driven changes in selected points from all traces.
Sourcepub fn template(&mut self, template: Any) -> &mut Self
pub fn template(&mut self, template: Any) -> &mut Self
Default attributes to be applied to the plot. Templates can be created from existing plots using Plotly.makeTemplate
, or created manually. They should be objects with format: {layout: layoutTemplate, data: {[type]: [traceTemplate, ...]}, ...}
layoutTemplate
and traceTemplate
are objects matching the attribute structure of layout
and a data trace. Trace templates are applied cyclically to traces of each type. Container arrays (eg annotations
) have special handling: An object ending in defaults
(eg annotationdefaults
) is applied to each array item. But if an item has a templateitemname
key we look in the template array for an item with matching name
and apply that instead. If no matching name
is found we mark the item invisible. Any named template item not referenced is appended to the end of the array, so you can use this for a watermark annotation or a logo image, for example. To omit one of these items on the plot, make an item with matching templateitemname
and visible: false
.
pub fn modebar(&mut self) -> &mut Modebar<'a>
pub fn newshape(&mut self) -> &mut Newshape<'a>
pub fn activeshape(&mut self) -> &mut Activeshape<'a>
Sourcepub fn meta(&mut self, meta: Any) -> &mut Self
pub fn meta(&mut self, meta: Any) -> &mut Self
Assigns extra meta information that can be used in various text
attributes. Attributes such as the graph, axis and colorbar title.text
, annotation text
trace.name
in legend items, rangeselector
, updatemenus
and sliders
label
text all support meta
. One can access meta
fields using template strings: %{meta[i]}
where i
is the index of the meta
item in question. meta
can also be an object for example {key: value}
which can be accessed %{meta[key]}.
Sourcepub fn transition(&mut self) -> &mut Transition
pub fn transition(&mut self) -> &mut Transition
Sets transition options used during Plotly.react updates.
Sourcepub fn clickmode(&mut self) -> &mut Clickmode
pub fn clickmode(&mut self) -> &mut Clickmode
Determines the mode of single click interactions. event is the default value and emits the plotly_click
event. In addition this mode emits the plotly_selected
event in drag modes lasso and select, but with no event data attached (kept for compatibility reasons). The select flag enables selecting single data points via click. This mode also supports persistent selections, meaning that pressing Shift while clicking, adds to / subtracts from an existing selection. select with hovermode
: x can be confusing, consider explicitly setting hovermode
: closest when using this feature. Selection events are sent accordingly as long as event flag is set as well. When the event flag is missing, plotly_click
and plotly_selected
events are not fired.
default: event
Sourcepub fn dragmode(&mut self, dragmode: Dragmode) -> &mut Self
pub fn dragmode(&mut self, dragmode: Dragmode) -> &mut Self
Determines the mode of drag interactions. select and lasso apply only to scatter traces with markers or text. orbit and turntable apply only to 3D scenes.
default: zoom
Sourcepub fn hovermode(&mut self, hovermode: Hovermode) -> &mut Self
pub fn hovermode(&mut self, hovermode: Hovermode) -> &mut Self
Determines the mode of hover interactions. If closest, a single hoverlabel will appear for the closest point within the hoverdistance
. If x (or y), multiple hoverlabels will appear for multiple points at the closest x- (or y-) coordinate within the hoverdistance
, with the caveat that no more than one hoverlabel will appear per trace. If x unified (or y unified), a single hoverlabel will appear multiple points at the closest x- (or y-) coordinate within the hoverdistance
with the caveat that no more than one hoverlabel will appear per trace. In this mode, spikelines are enabled by default perpendicular to the specified axis. If false, hover interactions are disabled. If clickmode
includes the select flag, hovermode
defaults to closest. If clickmode
lacks the select flag, it defaults to x or y (depending on the trace’s orientation
value) for plots based on cartesian coordinates. For anything else the default value is closest.
Sourcepub fn hoverdistance(&mut self, hoverdistance: u64) -> &mut Self
pub fn hoverdistance(&mut self, hoverdistance: u64) -> &mut Self
Sets the default distance (in pixels) to look for data to add hover labels (-1 means no cutoff, 0 means no looking for data). This is only a real distance for hovering on point-like objects, like scatter points. For area-like objects (bars, scatter fills, etc) hovering is on inside the area and off outside, but these objects will not supersede hover on point-like objects in case of conflict.
default: 20
Sourcepub fn spikedistance(&mut self, spikedistance: u64) -> &mut Self
pub fn spikedistance(&mut self, spikedistance: u64) -> &mut Self
Sets the default distance (in pixels) to look for data to draw spikelines to (-1 means no cutoff, 0 means no looking for data). As with hoverdistance, distance does not apply to area-like objects. In addition, some objects can be hovered on but will not generate spikelines, such as scatter fills.
default: 20
pub fn hoverlabel(&mut self) -> &mut Hoverlabel<'a>
Sourcepub fn selectdirection(&mut self, selectdirection: Selectdirection) -> &mut Self
pub fn selectdirection(&mut self, selectdirection: Selectdirection) -> &mut Self
When dragmode
is set to select, this limits the selection of the drag to horizontal, vertical or diagonal. h only allows horizontal selection, v only vertical, d only diagonal and any sets no limit.
default: any
pub fn grid(&mut self) -> &mut Grid<'a>
Sourcepub fn calendar(&mut self, calendar: Calendar) -> &mut Self
pub fn calendar(&mut self, calendar: Calendar) -> &mut Self
Sets the default calendar system to use for interpreting and displaying dates throughout the plot.
default: gregorian