General purpose convenience visualization function. Simply add other ggplot components after calling this function to customize more (e.g. with facet_wrap or theme calls). Make sure to specify lines = TRUE
and/or points = TRUE
to add the lines/points respectively. Accepts multiple y variables in which case they are plotted in a facet_wrap with new variables panel
holding the name of the y variable panels, y_value
holding the values and y_error
holding the error values (if y_error
is supplied). Also always generates a new column called variable
that holds the variable names (y
) supplied to this function. All aesthetics parameters expect variables or expressions that are valid in the context of the dt
. For convenience, all aesthetics can also be (re)-named on the fly with c(new_name = expr)
and will include column units in the legend captions by default.
iso_plot_data( dt, x, y, ..., y_error = NULL, group = NULL, color = NULL, fill = NULL, shape = NULL, size = 4, linetype = NULL, alpha = NULL, label = NULL, panel = panel ~ ., panel_scales = "free_y", lines = FALSE, points = FALSE, date_breaks = NULL, date_labels = "%d %b %H:%M" )
dt | data frame to plot data from |
---|---|
x | the column or expression for the x-axis aesthetic. Can be a numeric, text or datetime column (text and datetime column labels will be automatically rotated by 90 degrees). For clarity of the plot, only one x variable or expression is allowed. Use named vector with |
y | which columns/expressions to visualize. Combine with |
... | additional ggplot objects (e.g. |
y_error | an error column for drawing y error bars - if multiple |
group | what to group by, multiple columns allowed (combine with |
color | variable to use for color aesthetic for the plot or constant value for the point and line color |
fill | variable to use for the fill aesthetic of the plot or constant value for the point fill |
shape | variable to use for shape aesthetic for the plot or constant vlaue for the point shape |
size | variable to use for size aesthetic for the plot or constant value for the points size |
linetype | variable to use for linetype aesthetic for the plot or constant value for the line type |
alpha | variable to use for the opacity aesthetic for the plot or constant value for the point and line opacity (1 = 100% opaque, 0 = completely transparent) |
label | this is primarily of use for turning the generated ggplots into interactive plots via |
panel | whether to panel the data by anything. If using a single parameter (e.g. |
panel_scales | the |
lines | whether to plot lines (FALSE by default) |
points | whether to plot points (FALSE by default) |
date_breaks | what breaks to use for the x axis if it is a datetime |
date_labels | datetime label pattern for x axis if it is a datetime |
Other plot functions:
iso_mark_calibration_range()
,
iso_mark_outliers()
,
iso_mark_value_range()
,
iso_mark_x_range()
,
iso_plot_continuous_flow_data()
,
iso_plot_dual_inlet_data()
,
iso_plot_raw_data()
,
iso_plot_ref_peaks()
,
iso_plot_residuals()
,
iso_plot_scan_data()
,
iso_prepare_continuous_flow_plot_data()
,
iso_prepare_dual_inlet_plot_data()
,
iso_prepare_scan_plot_data()