Recent Releases of grafify
grafify - v5.0.0
grafify v5.0.0
Major updates
This version has major updates to linear mixed effects models functions (mixed_model, mixed_anova, mixed_model_slopes, mixed_anova_slopes). The other major updates are to plot_density and plot_histogram, which can now plot probability density, counts or normalised counts (only latter two options for histograms). Most old code should still work, but care is needed if arguments are not explicitly called. Changes as follows:
Updates to
mixed_model,mixed_anova,mixed_model_slopes,mixed_anova_slopes:a. All functions now have a new argument
AvgRF, which is set to TRUE by default. This means that values of the response variable (Y_value) are averaged before a linear mixed effects model is fitted. This avoids pseudoreplication if there are multiple 'technical replicates' within levels of theRandom_Factor. For behaviour like before (v4.0.1 or lower), setAvgRF = FALSE. b. TheFormulaargument allows the user to directly provide a formula to lmer(), which may be useful in more complex scenarios (e.g., nested designs). This argument is available inmixed_modelandmixed_anovafunctions. c. The following transformations can be called directly on x (where x is a numeric variable passed on toY_valueorFixed_Factor: log(x), log(x + c), logit(x), log(x/100), sqrt() or exponents (e.g., (c)^2).Updates to arguments in
plot_densityandplot_histogram:a. both functions have a new argument
PlotTypeto choose a type of data transformation, i.e., useggplot2defaults or plot counts or normalised counts. Forplot_density, this argument can beDensity(default), which plots the smooth probability density curve,CountsorNormalised counts. Forplot_histogram, the default for this argument isCounts, which can be changed toNormalised counts. This is achieved by passingy = after_stat(count)ory = after_stat(count/max(count))togeom_densityorgeom_histogram. b. both functions also can do "log10" and "log2" along the X-axis (for plotting on semi-log plots). For consistency with otherplot_functions ingrafify, these arguments areLogYTrans,LogYBreaks,LogYLabelsandLogYLimits. c. aSingleColourargument has been added to change colours when a grouping variable is missing, i.e., when the argumentgroupis not provided with a value. If a value is provided, however,SingleColouris ignored and theColPalvalue is applied.
Minor updates
- In a couple of
plot_..functions, theLogYLabelsargument was calledYlabels, which has now been deprecated for consistency (old code will still work). - Since
ggplot2v3.5, thediscrete_scale()has been updated and an argument (scale_name) has been dropped. Thescale_fill_grafifyandscale_colour_grafifyfunctions have been accordingly updated. - Updated documentation and corrected links to other packages and DOIs.
- In plots that use
geom_violin(i.e.,plot_scatterviolin,plot_3d_scatterviolinandplot_4d_scatterviolin),drop = FALSEhas been added to avoid throwing up errors. Be careful if you have fewer than 2 data points.
- R
Published by ashenoy-cmbi 12 months ago
grafify - Version 4.0.1
grafify v4.0.1
This is a minor update to fix tests that were failing after an update to ggplot2 to version 3.5.0.
- R
Published by ashenoy-cmbi almost 2 years ago
grafify - Version 4.0
grafify v4.0
The reason this is a major update is that now ggplot2 version 3.4.0 or higher is required to avoid errors with grafify. The main difference is that size argument for line widths has been updated to linewidth.
Major updates
It is easier to plot 2-way ANOVA designs with or without blocking factors in this version with the following updates. There are two new
plot_...functions for 1-way and 2-way designs.a.
plot_4d_functions can now plot 2-way ANOVAs even if theshapesargument is not provided. Graph is plotted withshape = 21as default.b.
plot_4d_point_sdandplot_3d_point_sdfunctions for plotting 2-way and 1-way ANOVAs without or with blocking factors as mean and SD/SEM/CI95 error bars.
Minor updates
- Fixed the double
{{intheme_grafify. - Added
hjustandvjustarguments totheme_grafifyto adjust text alignment when angles are changed. - Several tests were rewritten to comply with
ggplot2update.
- R
Published by ashenoy-cmbi over 2 years ago
grafify - Version 3.2.0
grafify v3.2.0
Major updates
theme_grafifyupdates:a.
lineend = squareas default for better-looking origin b. transparent backgrounds throughout the plot c. this theme is now applied to allgrafifyplots by default d. all text size on the graph is now the same as thebasesize(default 20)New arguments in violin plots (
plot_dotviolin,plot_scatterviolin,plot_3d_scatterviolinandplot_4d_scatterviolin): two separate argumentsbthickandvthickto set the line widths of the boxes and violins, respectively. The previousbvthickwill still work, so if a value is provided that will be used for line widths of both boxes and violins.New argument for two-way ANOVA graphs (
plot_4d_): thegroup_widcan be used to change the space between groups along the X-axis (i.e., dodge width). Defaultgroup_wid = 0.8will produce graphs that look similar to those in previous versions ofgrafify. Ifgroup_widis set to 0, there will be no dodging of the factors along X-axis.New arguments in before-after plots (i.e.,
plot_befafter_):bthickandlthickarguments can change line and box line widths independently.
Minor updates
- For consistency, the default width (
bwidargument) of bars and boxes inplot_4d_functions is set as0.7. - Parts of code rewritten for many plot functions to make them shorter and simpler.
log10tick marks: a. In allplot_functions: the tick marks now scale with thefontsizeparameter. Previously, the sizes were set to "cm" units, which did not scale correctly. The long tick mark, middle and short ticks are sized:7*fontsize/22,4*fontsize/22and4*fontsize/22, respectively (note that the short and mid are the same size). The size (line width) equalsfontsize/22, which is the same throughoutgrafify. b. For consistency and usefulness, theplot_logscalesfunction also has the above defaults and now hasfontsize = 20as an additional argument and sizes scale accordingly. c. Colour oflog10tick marks have the same colour as ticks on non-transformed axis (grey20).
- R
Published by ashenoy-cmbi almost 3 years ago
grafify - Version 3.1.0
grafify v3.1.0
New functionalities
plot_point_sdnow allows all data points to be shown. All points will be plotted withgeom_pointif theall_alphasetting (opacity for all symbols) is set >0 (it is set to 0 so default graphs will only show the mean of all values). There are also options forall_sizeandall_jitterto adjust size and overlap.- SD, SEM or CI95 error bars are now possible through the
ErrorTypeargument (default is "SD" error bars) inplot_dotbar_sd,plot_scatterbar_sd,plot_point_sd,plot_3d_scatterbarandplot_4d_scatterbar.
Minor updates
- Y-axis labels fixed for
plot_lm_predictwhich used to label Y-axis aspredrather than the correct name of the plotted variable. - Fixed the example for
theme_grafify. - Re-written
plog_qqlinebased onstat_qqandstat_qqline. - Also re-written
plot_histogramwhich was throwing up warning messages afterggplot2update. For uniformity with othergrafifygraphs, histograms now have a black border (like symbol borders in dot/scatter plots). groupsargument, which was deprecated several versions before, has been removed from before-after functions.plot_bar_sddeprecated as similar graphs can be plotted withplot_scatterbar_sdwiths_alpha = 0.- Fixed an error in
scale_colour_grafify, which broke in v3.0.0. SingleColourargument can now take base R colour names (e.g., "grey25") in addition to previously available options.plot_grafify_palettecan now also plot the quantitative colour schemes.
- R
Published by ashenoy-cmbi about 3 years ago
grafify - Version 3.0.0
grafify v3.0.0
Major updates
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.
Major additions
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.
Minor changes
Much of the code has been edited and cleaned up. Among the main change is dropping unnecessary double curly brackets {{ }} within plot_ wrappers.
- R
Published by ashenoy-cmbi over 3 years ago
grafify - Version 2.3.0
grafify v2.3.0
The main motivation behind this update was to simplify the package by reducing the number of exported functions. So some features that were previously in separate functions have been made available more easily via an additional argument to existing functions (e.g. single colour function (plot_..._sc) now offered in respective plot_ function with a new argument (see below). This has uncluttered the namespace of grafify. Most of the other additions are related to colour schemes.
Major additions
A new
SingleColourargument has been added to two-variablesplot_functions to generate graphs with a single colour along the X-axis aesthetic. This means the 8plot_..._scfunctions introduced in v1.5.0 are deprecated, but this feature is still retained in existingplot_functions. This option also added toplot_3d_functions for plots of one-way ANOVA data.Four new colourblind-friendly categorical colour schemes (chosen from cols4all package):
fishy,kelly,r4,safe
- Four new quantitative schemes for continuous or divergent colours.
- sequential/continuous:
blue_conti,grey_conti - divergent:
OrBl_div,PrGn_div
All schemes also available through scale_fill.. and scale_colour_... calls to be used on any ggplot2 object.
scale_fill_grafifyandscale_colour_grafify(orscale_color_grafify) have been rewritten. These have two new arguments that offer features previously inscale_fill_grafify2/scale_colour_grafify2/scale_color_grafify_candscale_fill_grafify_c/scale_colour_grafify_c/scale_color_grafify_Cscale functions. These 6 functions are now deprecated to reduce exported namespace.
The new arguments are discrete (logical T/F) to select discrete or continuous palettes, and ColSeq (logical T/F) to pick sequential or distant colours from a chosen palette.
Minor changes & bug fixes
- Fixed the error in legend title in one-way ANOVA plots with
plot_3d_that incorrectly referred toxcolandshapesarguments. - Fixed the error that led to depiction of different shapes in
plot_3d_scatterviolinas compared to the other twoplot_3d_functions. posthoc_Trends...functions rewritten withstats::model.frame()to get model data frame as this is a more flexible method.- Order of colours in
light,brightandmutedschemes changed slightly for better separation of colours when next to each other. - The
jittersetting inplot_scaltter_is set to0.2so the graph as plotted with jitter by default. - The default colour scheme for all graphs is now
okabe_ito(theall_grafifypalette is was just a concatenation of all palettes without real basis in good visualisation). Use one of the other palettes if more than 8 colours are needed (e.g.kelly, which has 20 discreet colours).
- R
Published by ashenoy-cmbi over 3 years ago
grafify - Release v2.2.0
grafify v2.2.0
New features
plot_3d_scatterviolin and plot_4d_scatterviolin for one-way or two-way ANOVA design data to plot scatter plots with violins with box and whiskers.
Minor fixes
plot_qqmodel no longer relies on broom.mixed; instead uses rstudent from the base stats package to generate studentized residuals from a model.
- R
Published by ashenoy-cmbi almost 4 years ago
grafify - Version v2.1.0
grafify v2.1.0
New features
New experimental functions to compare slopes of linear regression via posthocTrendsPairwise, posthocTrendsLevelwise and posthocTrendsvsRef.
Minor fixes
Minor changes to plotqqmodel and plotqqline to fix some OS-specific errors. QQ plots by default will have okorange colour within symbols when only one level is present within group. Both functions now use geomqq and geomqqline (instead of statqq and statqq_line) internally.
- R
Published by ashenoy-cmbi about 4 years ago
grafify - Version v2.0.0
grafify v2.0.0
This is a major update with some new features, bugfixes, and further cleaning up of code with consistent names of arguments in preparation for CRAN submission. Some previous code may not work because of renaming of some arguments for grouping variables in plot_ functions. But older arguments are retained with deprecation warnings in most cases, so old code should largely work.
New features:
a. plot_ functions have a new argument ColSeq (logical TRUE/FALSE) that picks colours sequentially from palette chosen by ColPal when TRUE (default). If set to FALSE, the most distant colours are chosen, as already implemented in scale_..._grafify2 functions.
b. Violin plots get a major face-lift with a box-whiskers plot on top of the violin. This gives a clearer picture of data and dispersion than the default quantile lines in geom_violin. They also get new arguments to set thickness of lines (bvthick) and transparency of boxplots (b_alpha).
c. There are new functions for fitting linear models with varying slopes and intercepts. These are mixed_model_slopes and mixed_anova_slopes.
d. A function for comparing slopes of linear fits posthoc_Trends implements the emmeans::emtrends call.
e. Most plot_ functions now have the ... argument forwarding dots for advanced users to add arguments to ggplot geometries where necessary.
f. New plot_grafify_palette function that helps quickly visualise colours in palettes along with their names and hexcodes.
g. plot_bar_sd and plot_bar_sd_sc have a new argument bthick to adjust the thickness of lines of the bars.
Bug fixes
a. Distribution plots: the The Group grouping argument in plot_density, plot_histogram and plot_qqline is now called group for consistency with other plot_ functions.
c. The Factor argument in post-hoc comparisons functions (posthoc_Pairwise, posthoc_vsRes, and posthoc_Levelwise) renamed as Fixed_Factor to be consistent with mixed_model, simple_model, mixed_anova and simple_anova functions.
d. The plot_3d_scatterbar and plot_3d_scatterbox now correctly plot one-way ANOVA designs with randomised blocks with shapes mapped to levels of the random factor, and xcol as the grouping factor as originally intended but incorrectly implemented. This complements plot_4d_scatterbar and plot_4d_scatterbox which take two grouping factors and a random factor.
e. Examples in help files have arguments explicitly labelled to make them easier to follow.
f. groups in before-after plots is now called match as it is a bit more informative when showing matched data.
g. For consistency, the argument for controlling opacity in distribution plots is renamed c_alpha in plot_density and plot_histogram (for colour opacity of colours under the density curve or histogram); opacity of symbols in plot_qqline is still called s_alpha.
- R
Published by ashenoy-cmbi about 4 years ago
grafify - v1.5.1
v1.5.1
This update fixes and cleans up code to remove all errors, warnings and notes from devtools::check(). All previous code should still work.
a. The main update is that broom.mixed::augment is used to get model residuals than the fortify method as this will be deprecated soon. The broom.mixed package therefore required.
b. The way ANOVA table is generated no longer relies on an internal function from lmerTest, but instead forces a mixed model object as lmerModLmerTest object to get F and P values in ANOVA tables from the stats::anova call.
c. The magrittr package is required for internal use of pipes (%>%).
d. Much of the code for simple_model and mixed_model was cleaned up so that model outputs are as close to objects generated by native calls to lm or lmer.
e. Several internal functions related to the colour palettes have now been exported as this was easier.
f. The make_1w_rb_data and make_2w_rb_data functions have been updated to have consistent factor and level names.
- R
Published by ashenoy-cmbi about 4 years ago
grafify -
New in v1.5.0
New graph types This version has 8 new plot_ functions ending in sc for plotting data with two variables wherein the X variable is plotted in a single colour. This contrasts existing versions that plot the X variable with multiple colours chosen from the allgrafify palette. This is convenient when there are too many groups on the X axis and multiple colours are not necessary.
Plotting Q-Q plot of model residuals plotqqmodel will plot a diagnostic Q-Q plot of a simple linear model (generated with simplemodel or lm) or mixed effects linear model (generated with mixed_model or lmer) in a single step.
Minor fixes Fixed a typo in posthoc_Levelwise where the adjust argument wasn not being correctly passed on to emmeans.
(There was an issue with tag 1.5.0, so this is an updated tag 1.5.0.0 only.)
- R
Published by ashenoy-cmbi about 4 years ago
grafify - Version 1.4.1 release on zenodo
This is v1.4.1 with a link to zenodo for DOI.
- R
Published by ashenoy-cmbi over 4 years ago
grafify - Version 1.4.1
New in v1.4.1
This version "breaks" a few arguments from v0.3.1, therefore is v1.4.1. Specifically, opacity for both symbols and bars/boxes/violins can be set using s_alpha and b_alpha or v_alpha, respectively; previously, only bars/boxes/violin opacity could be set with a single alpha parameter. Old code with just alpha will no longer work, sorry! There are also new graph types and arguments for ANOVAs as below.
New graph types
a.
plot_densityandplot_histogramfor smooth density or histogram plots throughgeom_densityandgeom_histogramrespectively. b. two new plot typesplot_scatterboxandplot_scatterviolinthat complement theplot_dot...versions and instead usegeom_pointwithposition_jitter. These versions are useful when a large number of data points are needed to be plotted.Updates
a.
simple_anovawhere the table also has Mean SS. b.mixed_anovanow has two new arguments, one to change method for Df calculation and second to get type I or III SS (default is type II). c.jitterargument added toplot_3d..andplot_4d..functions for consistency with other scatter plots. d.bwidargument (for adjusting width of bars) added toplot_scatterbar_sdfor consistency.
- R
Published by ashenoy-cmbi almost 5 years ago
grafify - Version 0.3.1
Minor bug fixes.
Bug fixes in mixed_model and simple_model which now correctly lists the data used in the call field.
- R
Published by ashenoy-cmbi about 5 years ago
grafify - Version 0.3.0
New in v0.3.0
- A new
plot_4d_scatterbarfunction which is likeplot_4d_scatterboxbut plots bar and SD. So there are now twoplot_3d_andplot_4d_functions. - Text on X-axis on all graphs can be rotated from 0-90 using
TextXAngleargument to prevent overlap. plot_dot_functions now havedotthickoption to set stroke thickness. This is similar tosymthickfor scatter/jitter plots.- Using
facet_wraporfacet_gridwill not draw a box around panel text (unlike the default intheme_classic()). plot_3d_andplot_4d_functions draw symbols in black colour.
- R
Published by ashenoy-cmbi about 5 years ago
grafify - Version v0.2.1
Fixed in v0.2.1:
- Bug fixes in
plot_3d_scatterbarandplot_3d_scatterbox, which now correctly use the "shapes" variable to fill colour of bars/boxes and shape of the symbols; symbols are depicted in black. simple_anovagenerates type II ANOVA table throughcar::Anova(), which is now a dependency. v0.1.0 and v0.2.0 generated type I ANOVA table throughstats::anova().
- R
Published by ashenoy-cmbi about 5 years ago
grafify - Version v0.2.0
New in v0.2.0:
1. the main difference from v0.1.0 is that all plot_ functions apply
the all_grafify colour scheme by default (see plot_ vignettes on
how to change colours)
2. two new types of grafs are possible with two quantitative X-Y plots
with a third variable that is either numeric (plot_xy_NumGroup) or
categorical (plot_xy_CatGroup).
3. there are two new continuous colour schemes (scale_fill_grafify_c
and scale_colour_grafify_c), based on Paul Tol’s
variant of YlOrBl
scheme.
- R
Published by ashenoy-cmbi about 5 years ago