horizonaes | R Documentation |
Add additional aesthetics to the horizon plot object, returning them in the
form of a list of ggplot aesthetics to supply to horizonplot()
.
horizonaes(
title = NA,
subtitle = NA,
xlabel = NA,
ylabel = NA,
showColorLegend = TRUE,
showLegendLabels = TRUE,
legendPosition = "right",
legendTitle = NA,
showPlotLabels = TRUE,
col.bands = NA,
col.outline = "#CCCCCC",
col.border = "#CCCCCC"
)
title |
character. The text for the title. |
subtitle |
character. The text for the subtitle, displayed below the title. |
xlabel |
character. The text for the x-axis label. If |
ylabel |
character. The text for the y-axis label. |
showColorLegend |
logical. If |
showLegendLabels |
logical. If |
legendPosition |
character. Where should the color scale legend be displayed? Possible values are "right" (the default), "left", "top", and "bottom". For the latter two options, the legend will appear horizontal. |
legendTitle |
character. The text for the title of the color scale legend. |
showPlotLabels |
logical. If |
col.bands |
character vector of hexadecimal color codes giving the color
scale for horizon bands. Colors should be specified from the most negative
band to the most positive band. Must be the same length as |
col.outline |
character string specifying the hexadecimal color code for
the outline on top of the graph of each band. If |
col.border |
character string specifying the hexadecimal color code for
panel borders. If |
Setting any aesthetic to NA
will use the default value. For most
values, this means the aesthetic will be blank or not appear on the horizon
plot. Other values like xlabel will use their default text. If an aesthetic
is already in the horizon plot by default, and you want to remove it, you can
do so by setting the respective argument to NULL
.
This function provides an easy way to add the most common aesthetics to the
horizon plot, but if you want to add other aesthetics not included in this
function, you can do so by appending them to the horizon plot object using
the +
operator. e.g. to add a gray background in the plotting area:
horizonplot(prepanel(otudata = otusample_diet,
metadata = metadatasample_diet, taxonomydata = taxonomysample_diet,
subj = "MCTs01")) + theme(panel.background = element_rect(fill="gray90"))
A list containing custom ggplot aesthetics to override default values
on the horizon plot. This list can then be supplied to horizonplot()
to apply the aesthetics.
plist <- prepanel(otudata = otusample_diet, metadata = metadatasample_diet,
taxonomydata = taxonomysample_diet, subj = "MCTs01")
# By default, the function is called with no arguments to use default aesthetics
horizonplot(plist, horizonaes())
# Same plot as above
horizonplot(plist)
# Add a custom title, ylabel
horizonplot(plist, horizonaes(title = "Microbiome Horizon Plot", ylabel = "OTU ID"))
# Remove the default x-label
horizonplot(plist, xlabel = NULL)
# Use a different colorscale
library(RColorBrewer)
horizonplot(plist, horizonaes(col.bands = brewer.pal(8, "PiYG")))
# To add aesthetics not included in this function, append them to the
# horizon plot object. e.g. for a gray plotting area background:
horizonplot(plist) + theme(panel.background = element_rect(fill = "gray90"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.