Description Usage Arguments Details Value Author(s) See Also Examples
This function will create a heatmap using ggcorrplot(). The function will produce the correlation (or partial correlation) matrix using corMatrix() and then construct the figure. Users are given a limited number of options for adjusting the figures and can supply their own theme().
1 |
dat |
data frame including metabolites and (optionally) covariates |
compid |
Character vector of COMP_IDs included in the heatmap |
covariates |
Optional vector of covariates. If supplied, heatmap will be based on a partial correlation matrix |
biochem |
Data frame of biochemical metadata. At a minimum it must have two variables: COMP_ID and BIOCHEMICAL. The BIOCHEMICAL will be used to label the y-axis. If left NULL, COMP_IDs will be used to label the x- and y-axes. |
method |
Correlation methods: "pearson" (default), "spearman", or "kendall" |
hclust |
Logical: use heirarchical clustering for arranging the heatmap? Defaults to TRUE |
title |
Title for your plot, required. |
subtitle |
Optional subtitle. If left NULL, some summary information about the correlations will be added. |
plot_colors |
Adjust the color scheme by provided exactly THREE colors. Correlations range from -1.0 to 1.0. The first color wil be -1.0, middle color will be 0, and third color will be 1.0. The function will create gradations between these colors. |
xaxis_size |
Text size for the x-axis |
yaxis_size |
Text size for the y-axis |
title_size |
Text size for the title |
subtitle_size |
Text size for the subtitle |
plot_theme |
Optional ggplot2 theme. metsHeatmap() will create a theme based on some of your options. You can create a custom theme using theme() and include the name of this theme object in this argument to apply it. |
Building heatmaps from ggcorrplot() is a tedious process, hopefully this makes it a bit easier. Users should be able to edit most of the plot using theme() elements, or they can accept the defaults. The function returns a ggplot2 object, so you can edit the plot after running the function.
ggplot object
Brian Carter
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | breast_metabolomics <- getMetabolites("breast_metabolomics")
biochem <- b$biochem
metdata <- dplyr::left_join(survey,breast_metabolomics$metabolites,"ID")
comp.id <- sample(biochem$COMP_ID,50,replace=T)
png(file.path("test mets heatmap.png"),height=10,width=10,units="in",res=400)
metsHeatmap(metdata,
compid=comp.id,
covariates=NULL,
biochem=NULL,
method="pearson",
hclust=T,
title="Title to test my new metsHeatmap() function",
subtitle="here's a subtitle describing something or another",
plot_colors=NULL,
xaxis_size=7,
yaxis_size=7,
title_size=12,
subtitle_size=8,
plot_theme=NULL)
dev.off()
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.