Interactive Plot (incl. Zooming, Data Reading...etc) of EPR Spectra
Source:R/plot_EPR_Specs2D_interact.R
plot_EPR_Specs2D_interact.Rd
Interactive visualization of EPR spectra or their integrals based on plotly package.
In the first step function takes the essential plot parts as ggplot2,
which is subsequently transferred by ggplotly
into the final interactive format.
Such plots mostly contain buttons in order to zoom,
move and select (parts of) the EPR spectra/integrals as well as to display the point values directly within
graph/panel. Additionally, plots can be exported into .png
image
or .html
formats (see also plot_EPR_present_interact
) and can optionally
also contain tools to draw lines, circles or rectangles
directly into the plot panel for annotations.
Usage
plot_EPR_Specs2D_interact(
data.spectra,
x = "B_mT",
x.unit = "mT",
Intensity = "dIepr_over_dB",
var2nd.series = NULL,
lineSpecs.form = "derivative",
line.colors = "darkviolet",
line.width = 0.75,
line.type = 1,
bg.color = "#e5ecf6",
grid.color = "white",
border.line.width = 1.2,
border.line.color = "black",
legend.title = NULL,
legend.title.size = NULL,
axis.title.size = 15,
axis.text.size = 14
)
Arguments
- data.spectra
Spectrum data frame/table object, containing magnetic flux density, \(g\)-value or radio-frequency columns as
x
variable. They can be labeled asField
,B_mT
in mT (orB_G
in gauss), see alsox
parameter/argument. They/Intensity
variable can be labeled asdIepr_over_dB
, in case of derivative intensity, or if integrated or simulated spectra intensities are present, they can be labeled accordingly. See alsoIntensity
parameter/argument. For spectral series the second independent variablevar2nd.series
column (e.g.var2nd.series = "time_s"
) must be available. In such case, the entiredata.spectra
must be present in the form of tidy/long table format (see also parameter/argumentvar2nd.series
).- x
Character string, pointing to \(x\)-axis/column quantity in the original
data.spectrum
like magnetic flux density \(B\), \(Field\), \(g\)-Value or \(RF\) (radio frequency), default:x = "B_mT"
.- x.unit
Character string pointing to \(x\)-unit of quantity (coming from the original ASCII data, see also
column.names
parameter) which is to be presented on \(x\)-axis of the EPR spectrum, like"G"
("Gauss"),"mT"
("millitesla"),"MHz"
("megahertz", in the case of ENDOR spectra) or"Unitless"
in case of \(g\)-values, default:x.unit = "mT"
.- Intensity
Character string, corresponding to the intensity column header in the original
data.spectrum
if other thandIepr_over_dB
name/label is used (e.g. for integrated or simulated spectra), default:Intesity = "dIepr_over_dB"
.- var2nd.series
Character string, referred to name of the second independent variable/quantity column in the original
data.spectra
(such as time, Temperature, Electrochemical Potential, Microwave Power...etc) altered upon individual experiments. Data must be available in long table (or tidy) format (see alsodata.spectra
argument). Default:var2nd.series = NULL
. Otherwise, usually,var2nd.series = "time_s"
.- lineSpecs.form
Character string, describing either
"derivative"
(default) or"integrated"
(i.e."absorption"
which can be used as well) line form of the analyzed EPR spectrum/integral.- line.colors
Character string (vector). In case of of SIMPLE SPECTRUM (NOT FOR
var2nd.series
) ONLY ONE COLOR CHARACTER STRING IS REQUIRED => therefore, default:line.color = "darkviolet"
. For the SERIES OF SPECTRA CHARACTER COLOR VECTOR WITH THE LENGTH \(\geq 2\) must be DEFINED (e.g.line.colors = c("darkorange","darkblue")
).- line.width
Numeric, linewidth of the plot line in
mm
, default:line.width = 0.75
.- line.type
Character string or integer, corresponding to width of the (spectral) line(s). Following types can be specified:
0 = "blank"
,1 = "solid"
(default),2 = "dashed"
,3 = "dotted"
,4 = "dotdash"
,5 = "longdash"
and6 = "twodash"
.- 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.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"
.- 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"
.- legend.title
Character string \(\equiv\) title of the legend (if the
var2nd.series
in NOTNULL
). It can be defined either by simple text likelegend.title = "Time (s)"
or if additional formatting is required, thehtml
markup 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.size
Numeric, text size (in
px
) for the legend title, default:legend.title.size = NULL
, which actually corresponds to13
if not otherwise defined.- axis.title.size
Numeric, text size (in
px
) for the axis title, default:axis.title.size = 15
.- axis.text.size
Numeric, text size (in
px
) for the axis unit values/descriptions, default:axis.text.size = 14
.
See also
Other Visualizations and Graphics:
draw_molecule_by_rcdk()
,
plot_EPR_Specs()
,
plot_EPR_Specs3D_interact()
,
plot_EPR_Specs_integ()
,
plot_EPR_present_interact()
,
plot_labels_xyz()
,
plot_layout2D_interact()
,
plot_theme_In_ticks()
,
plot_theme_NoY_ticks()
,
plot_theme_Out_ticks()
,
present_EPR_Sim_Spec()
Examples
## load built-in EPR spectral data
data.file.path <-
load_data_example(file = "TMPD_specelchem_accu_b.asc")
## spectrum recorded as accumulation of 20 scans
data.epr <-
readEPR_Exp_Specs(path_to_ASC = data.file.path,
col.names = c("B_G", "dIepr_over_dB"),
qValue = 3500,
norm.vec.add = 20,
origin = "winepr")
## interactive plot or screenshot
plot_EPR_Specs2D_interact(data.spectra = data.epr)
#
## 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")
#
if (FALSE) { # \dontrun{
## plot time series EPR spectra = verdazyl radical
## oxidation kinetics (`verdazylRad.kinet.spectr`)
plot_EPR_Specs2D_interact(verdazylRad.kinet.spectr,
x = "B_G",
x.unit = "G",
var2nd.series = "time_s",
legend.title = "<i>Time</i> (s)",
line.colors = c("darkorange","darkblue")
)
} # }