Additional Layout for the Interactive 2D Plots
Source:R/plot_layout2D_interact.R
plot_layout2D_interact.RdAdditional customization of interactive 2D plots (see also plot_EPR_Specs2D_interact).
The main goal is to simplify setting up process of the layout via several nested lists.
Mostly, it nicely works (using the %>%) either with the general plot_ly
or the above-mentioned plot_EPR_Specs2D_interact (see also Examples).
Usage
plot_layout2D_interact(
p,
data = NULL,
xlab = "<i>B</i> (mT)",
ylab = "d <i>I</i> <sub>EPR</sub> / d <i>B</i> (p.d.u.)",
axis.title.x.family = "Arial",
axis.title.x.color = "black",
axis.title.x.size = 15,
axis.text.x.family = "Arial",
axis.text.x.color = "black",
axis.text.x.size = 14,
axis.title.y.family = "Arial",
axis.title.y.color = "black",
axis.title.y.size = 15,
axis.text.y.family = "Arial",
axis.text.y.color = "black",
axis.text.y.size = 14,
legend.title = NULL,
legend.title.family = "Arial",
legend.title.color = "black",
legend.title.size = 13,
bg.color = "#e5ecf6",
grid.x = TRUE,
grid.y = TRUE,
grid.color = "white",
grid.line.width = 1,
grid.line.type = "solid",
border.line.width = 1.4,
border.line.color = "black"
)Arguments
- p
Plotlyobject, corresponding to previous/actual graph/plot.- data
Data frame object in order to associate with the layout (optional). If not provided, arguments are evaluated using the data frame in
plot_lyfunction of the previous/actual plot. Therefore, default:data = NULL.- xlab
Character string \(\equiv\) title of the \(x\)-axis. Either simple, like
xlab = "B (mT)"can be applied or if additional formatting is required, thehtmlmarkup language is used, such asxlab = "<i>B</i> (mT)"(default). If a \(\LaTeX\) typesetting is required for the title, please refer to e.g. LaTeX Plotly Tepesetting.- ylab
Character string \(\equiv\) title of the \(y\)-axis (see also
xlab), default:ylab = "d <i>I</i> <sub>EPR</sub> / d <i>B</i> (p.d.u.)".- axis.title.x.family
Character string, setting the font of the \(x\)-axis title. Following
htmlfonts are available: "Arial" (default), "Balto", "Courier New", "Droid Sans", "Droid Serif", "Droid Sans Mono", "Gravitas One", "Old Standard TT", "Open Sans", "Overpass", "PT Sans Narrow", "Raleway" and "Times New Roman".- axis.title.x.color
Character string, pointing to color of the \(x\)-axis title font, default:
axis.title.x.color = "black". Additional available colors are listed at the CSS Color Module Homepage.- axis.title.x.size
Numeric, setting up the size of the \(x\)-axis title font in
px, default:axis.title.x.size = 15.- axis.text.x.family
Character string, setting the font of the \(x\)-axis text. Following
htmlfonts are available: "Arial" (default), "Balto", "Courier New", "Droid Sans", "Droid Serif", "Droid Sans Mono", "Gravitas One", "Old Standard TT", "Open Sans", "Overpass", "PT Sans Narrow", "Raleway" and "Times New Roman".- axis.text.x.color
Character string, pointing to color of the \(x\)-axis text font, default:
axis.title.x.color = "black". Additional available colors are listed at the CSS Color Module Homepage.- axis.text.x.size
Numeric, setting up the size of the \(x\)-axis text font in
px, default:axis.title.x.size = 14.- axis.title.y.family
Character string, setting the font of the \(y\)-axis title (see also
axis.title.x.family). Default:axis.title.y.family = "Arial".- axis.title.y.color
Character string, pointing to color of the \(y\)-axis title font (see also
axis.title.x.color). Default:axis.title.y.color = "black".- axis.title.y.size
Numeric, setting up the size of the \(y\)-axis title font in
px, default:axis.title.x.size = 15.- axis.text.y.family
Character string, setting the font of the \(y\)-axis text (see also
axis.text.x.family). Default:axis.text.y.family = "Arial".- axis.text.y.color
Character string, pointing to color of the \(y\)-axis text font (see also
axis.text.x.color). Default:axis.text.y.color = "black".- axis.text.y.size
Numeric, setting up the size of the \(y\)-axis text font in
px, default:axis.text.x.size = 14.- legend.title
Character string \(\equiv\) title of the legend (if the
var2nd.seriesin NOTNULL). It can be defined either by simple text likelegend.title = "Time (s)"or if additional formatting is required, thehtmlmarkup language, such aslegend.title = "<i>Time</i> (s)"orlegend.title = "<i>Potential<i> <br> <i>vs</i> Fc/Fc<sup>+</sup> (V)"is used. If a \(\LaTeX\) typesetting is required for the title, please refer to e.g. LaTeX Plotly Tepesetting. Default:legend.title = NULL(in all cases ifvar2nd.series = NULL).- legend.title.family
Character string, setting the font of the legend title. Following
htmlfonts are available: "Arial" (default), "Balto", "Courier New", "Droid Sans", "Droid Serif", "Droid Sans Mono", "Gravitas One", "Old Standard TT", "Open Sans", "Overpass", "PT Sans Narrow", "Raleway" and "Times New Roman".- legend.title.color
Character string pointing to color of the legend title font, default:
legend.title.x.color = "black". Additional available colors are listed at the CSS Color Module Homepage.- legend.title.size
Numeric, text size (in
px) for the legend title, default:legend.title.size = NULL, which actually corresponds to13if not otherwise defined.- bg.color
Character string, corresponding to background color of the panel/graph. Available colors are listed on the CSS Color Module Homepage. Default:
bg.color = "#e5ecf6"(corresponding to light blue-gray).- grid.x
Logical, whether to show (
grid.x = TRUE, default) or hide the grid \(x\)-axis lines.- grid.y
Logical, whether to show (
grid.y = TRUE, default) or hide the grid \(y\)-axis lines.- grid.color
Character string, corresponding to grid lines color of the panel/graph. Available colors are listed on the CSS Color Module Homepage. Default:
grid.color = "white".- grid.line.width
Numeric, width (in
px) of the graph/plot panel grid lines, default:grid.line.width = 1.4.- grid.line.type
Character string, corresponding to type of the grid line. In addition to
grid.line.type = "solid"(default), "dot", "dash", "longdash", "dashdot", "longdashdot" can be used, as well.- border.line.width
Numeric, width (in
px) of the graph/plot panel border line, default:border.line.width = 1.2.- border.line.color
Character string, referring to color of the plot graph/panel border line. Available colors are listed on CSS Color Module Homepage. Default:
border.line.color = "black".
Value
List of the interactive plot object properties/parts, which can be used in the combination with
plot_EPR_Specs2D_interact or plot_ly.
See also
Other Visualizations and Graphics:
draw_molecule_by_rcdk(),
plot_EPR_Specs(),
plot_EPR_Specs2D_interact(),
plot_EPR_Specs3D_interact(),
plot_EPR_Specs_integ(),
plot_EPR_present_interact(),
plot_labels_xyz(),
plot_theme_In_ticks(),
plot_theme_NoY_ticks(),
plot_theme_Out_ticks(),
present_EPR_Sim_Spec()
Examples
## example from `plot_EPR_Specs2D_interact()`
## loading the built-in CW ENDOR spectrum
## of perinaphthenyl (PNT)
pnt.file.path <- load_data_example("PNT_ENDOR_a.txt")
## read the PNT CW ENDOR data without intensity
## normalization
pnt.endor.data <-
readEPR_Exp_Specs(pnt.file.path,
col.names = c("index",
"RF_MHz",
"dIepr_over_dB"),
x.unit = "MHz")
## plotting ENDOR spectrum
plot_EPR_Specs2D_interact(data.spectra = pnt.endor.data,
x = "RF_MHz",
x.unit = "MHz",
line.colors = "darkgreen",
bg.color = "cornsilk",
grid.color = "darkgrey") %>%
plot_layout2D_interact(xlab =
"<i>ν</i><sub>RF</sub> (MHz)",
axis.title.x.family = "Times New Roman",
axis.title.y.family = "Times New Roman",
border.line.color = "blue",
grid.y = FALSE
)