ashenoy-cmbi/grafify: Version 3.0.0
Description
This is a major update for grafify, which now provides wrappers for basic generalised additive models (gam) through the mgcv package. There are a more plot_ functions, a grafify theme for ggplot objects, and simple data wrangling before plotting.
Fit generalised additive models (gam) and get ANOVA tables with two new functions:
ga_modelandga_anova. These are mainly for time-series analyses or where an assumption of linear relationship between predictor and outcomes is absent straight lines are not appropriate. Factor-wise smooths are fit with thebyargument inmgcv, without or with a random factor. Random factors are also allowed with smoothresmooth. See documentation formgcvsmooths. Model diagnostics can be done withplot_qq_gamandplot_qq_model. Example data included asdata_zooplanktonis from Lathro RC, 2000.All
plot_functions now have two major updates:
a. Log-transformation of axes: Axes can be transformed with log10 or log2 with LogYTrans and LogXTrans arguments. X axis transformations are only available for plot_xy_CatGroup and plot_xy_NumGroup. With log10 transformation, log-ticks will also appear. Default axes limits and labels should work in most cases, but if needed, three additional arguments are available: LogYBreaks, LogYLimits and LogYLabels (and respective ones for the X axis).
b. facet argument to add another variable to created faceted plots with the facet_wrap layer in ggplot2. A related argument facet_scales can be used to set Y or X axis scales on faceted panels.
- New plot functions:
a. plot_befafter_box is a new before-after plot function that includes a box and whisker plot to show data distribution in addition to lines joining matched data. In addition, both plot_befafter_colour and plot_befafter_shapes offer a box and whiskers summary of data.
b. plot_lm_predict and plot_gam_predict can be used to plot observed (raw) data and predicted data from fitted linear models.
c. plot_logscales is a function to easily perform "log10" or "log2" transformation on X or Y axes of any ggplot2 object along with log-ticks.
- Table manipulations:
a. table_x_reorder is a function to reorder levels within a categorical variable. This uses factor from base R stats package to convert a column into a factor and reorders it based on a user-provided vector of group names.
b. table_summary is a wrapper around aggregate (base R) function, which gives mean, median, SD, and counts grouped by one or more variables.
- A
grafifytheme forggplot2:theme_grafifyis a modification oftheme_classicfor making publication-readygrafify-like graphs easily when usingggplot2.
Much of the code has been edited and cleaned up. Among the main change is dropping unnecessary double curly brackets {{ }} within plot_ wrappers.
Files
ashenoy-cmbi/grafify-v3.0.0.zip
Additional details
Related works
- Is supplement to
- https://github.com/ashenoy-cmbi/grafify/tree/v3.0.0 (URL)