This is a minor update to fix tests that were failing after an update to
ggplot2 to version 3.5.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
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.
plot_4d_ functions can now plot 2-way ANOVAs even if the
shapes argument is not provided. Graph is plotted with
shape = 21 as default.
plot_3d_point_sd functions for plotting 2-way and 1-way ANOVAs without or with blocking factors as mean and SD/SEM/CI95 error bars.
lineend = square as default for better-looking origin
grafify plots by default
basesize (default 20)
New arguments in violin plots (
plot_4d_scatterviolin): two separate arguments
vthick to set the line widths of the boxes and violins, respectively. The previous
bvthick will 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 (
group_wid can be used to change the space between groups along the X-axis (i.e., dodge width). Default
group_wid = 0.8 will produce graphs that look similar to those in previous versions of
group_wid is set to 0, there will be no dodging of the factors along X-axis.
New arguments in before-after plots (i.e.,
lthick arguments can change line and box line widths independently.
bwid argument) of bars and boxes in
plot_4d_ functions is set as
log10 tick marks:
plot_ functions: the tick marks now scale with the
fontsize parameter. Previously, the sizes were set to “cm” units, which did not scale correctly. The long tick mark, middle and short ticks are sized:
4*fontsize/22, respectively (note that the short and mid are the same size). The size (line width) equals
fontsize/22, which is the same throughout
plot_logscales function also has the above defaults and now has
fontsize = 20 as an additional argument and sizes scale accordingly.
log10 tick marks have the same colour as ticks on non-transformed axis (
plot_point_sd now allows all data points to be shown. All points will be plotted with
geom_point if the
all_alpha setting (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 for
all_jitter to adjust size and overlap.
ErrorType argument (default is “SD” error bars) in
plot_lm_predict which used to label Y-axis as
pred rather than the correct name of the plotted variable.
plog_qqline based on
plot_histogram which was throwing up warning messages after
ggplot2 update. For uniformity with other
grafify graphs, histograms now have a black border (like symbol borders in dot/scatter plots).
groups argument, which was deprecated several versions before, has been removed from before-after functions.
plot_bar_sd deprecated as similar graphs can be plotted with
s_alpha = 0.
scale_colour_grafify, which broke in v3.0.0.
SingleColour argument can now take base R colour names (e.g., “grey25”) in addition to previously available options.
plot_grafify_palette can now also plot the quantitative colour schemes.
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. There are also updates within all
plot_ functions, which are a
facet argument, and log-transformations with axis tick marks.
Fit generalised additive models (gam) and get ANOVA tables with two new functions:
ga_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 the
by argument in
mgcv, without or with a random factor. Random factors are also allowed with smooth
re smooth. See documentation for
mgcv smooths. Model diagnostics can be done with
plot_qq_model. Example data included as
data_zooplankton is from Lathro RC, 2000.
plot_ functions now have two major updates:
LogXTrans arguments. X axis transformations are only available for
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:
LogYLabels (and respective ones for the X axis).
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:
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_shapes offer a box and whiskers summary of data.
plot_gam_predict can be used to plot observed (raw) data and predicted data from fitted linear models.
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_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.
table_summary is a wrapper around
aggregate (base R) function, which gives mean, median, SD, and counts grouped by one or more variables.
grafify theme for
theme_grafify is a modification of
theme_classic for making publication-ready
grafify-like graphs easily when using
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.
SingleColour argument has been added to two-variables
plot_ functions to generate graphs with a single colour along the X-axis aesthetic. This means the 8
plot_..._sc functions introduced in v1.5.0 are deprecated, but this feature is still retained in existing
plot_ functions. This option also added to
plot_3d_ functions for plots of one-way ANOVA data.
Four new colourblind-friendly categorical colour schemes (chosen from cols4all package):
Four new quantitative schemes for continuous or divergent colours.
All schemes also available through
scale_colour_... calls to be used on any
scale_color_grafify) have been rewritten. These have two new arguments that offer features previously in
scale_color_grafify_C scale 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.
plot_3d_ that incorrectly referred to
plot_3d_scatterviolin as compared to the other two
posthoc_Trends... functions rewritten with
stats::model.frame() to get model data frame as this is a more flexible method.
muted schemes changed slightly for better separation of colours when next to each other.
jitter setting in
plot_scaltter_ is set to
0.2 so the graph as plotted with jitter by default.
all_grafify palette 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).
plot_4d_scatterviolin for one-way or two-way ANOVA design data to plot scatter plots with violins with box and whiskers.
New experimental functions to compare slopes of linear regression via
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.
plot_ functions have a new argument
ColSeq (logical TRUE/FALSE) that picks colours sequentially from palette chosen by
TRUE (default). If set to
FALSE, the most distant colours are chosen, as already implemented in
geom_violin. They also get new arguments to set thickness of lines (
bvthick) and transparency of boxplots (
posthoc_Trends implements the
plot_ functions now have the
... argument forwarding dots for advanced users to add arguments to
ggplot geometries where necessary.
plot_grafify_palette function that helps quickly visualise colours in palettes along with their names and hexcodes.
plot_bar_sd_sc have a new argument
bthick to adjust the thickness of lines of the bars.
Group grouping argument in
plot_qqline is now called
group for consistency with other
Factor argument in post-hoc comparisons functions (
posthoc_Levelwise) renamed as
Fixed_Factor to be consistent with
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_scatterbox which take two grouping factors and a random factor.
groups in before-after plots is now called
match as it is a bit more informative when showing matched data.
plot_histogram (for colour opacity of colours under the density curve or histogram); opacity of symbols in
plot_qqline is still called
This update fixes and cleans up code to remove all errors, warnings and notes from
devtools::check(). All previous code should still work.
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.
lmerTest, but instead forces a mixed model object as
lmerModLmerTest object to get F and P values in ANOVA tables from the
magrittr package is required for internal use of pipes (
mixed_model was cleaned up so that model outputs are as close to objects generated by native calls to
make_2w_rb_data functions have been updated to have consistent factor and level names.
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
all_grafify palette. This is convenient when there are too many groups on the X axis and multiple colours are not necessary.
plot_qqmodel will plot a diagnostic Q-Q plot of a simple linear model (generated with
lm) or mixed effects linear model (generated with
lmer) in a single step.
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
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
plot_histogram for smooth density or histogram plots through
plot_scatterviolin that complement the
plot_dot... versions and instead use
position_jitter. These versions are useful when a large number of data points are needed to be plotted.
simple_anova where the table also has Mean SS.
mixed_anova now has two new arguments, one to change method for Df calculation and second to get type I or III SS (default is type II).
jitter argument added to
plot_4d.. functions for consistency with other scatter plots.
bwid argument (for adjusting width of bars) added to
plot_scatterbar_sd for consistency.
Bug fixes in
simple_model which now correctly lists the data used in the call field.
plot_4d_scatterbar function which is like
plot_4d_scatterbox but plots bar and SD. So there are now two
TextXAngle argument to prevent overlap.
plot_dot_ functions now have
dotthick option to set stroke thickness. This is similar to
symthick for scatter/jitter plots.
facet_grid will not draw a box around panel text (unlike the default in
plot_4d_ functions draw symbols in black colour.
plot_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_anova generates type II ANOVA table through
car::Anova(), so the
car package is now a dependency. v0.1.0 and v0.2.0 generated type I ANOVA table through
plot_ functions apply the
all_grafify colour scheme by default (see
plot_ vignettes on how to change colours)
plot_xy_NumGroup) or categorical (
scale_colour_grafify_c), based on Paul Tol’s variant of YlOrBl scheme.