| gganatogram | R Documentation | 
This function plots anatograms of specified tissues, species, and sex .
gganatogram(data = NULL, outline = TRUE, fillOutline = "lightgray",
  organism = "human", sex = "male", fill = "colour",
  anatogram = NULL, ggplot2_only = FALSE)
data | 
 The main data frame consisting of what organs to plot, colours, and values. Default is NULL  | 
outline | 
 logical indicating if the outline of the organism should be plotted  | 
fillOutline | 
 Fill colour of outline. Default is #a6bddb  | 
organism | 
 The organism to be plotted.  Currently,
only   | 
sex | 
 Sex of the organism  | 
fill | 
 How to fill  | 
anatogram | 
 A list, similar to   | 
ggplot2_only | 
 If   | 
library(ggplot2)
#First lets just plot the outline. Only male human is possible now
gganatogram(fillOutline='#a6bddb', organism='human',
sex='male', fill="colour")
gganatogram(fillOutline='#a6bddb', organism='human',
sex='female', fill="colour")
gganatogram(fillOutline='#a6bddb', organism='mouse',
sex='Male', fill="colour")
#To add organs, create a data frame with specified tissues
organPlot <- data.frame(organ = c("heart", "leukocyte", "nerve", "brain",
     "liver", "stomach", "colon"),
 type = c("circulation", "circulation",
     "nervous system", "nervous system", "digestion", "digestion",
     "digestion"),
 colour = c("red", "red", "purple", "purple", "orange",
     "orange", "orange"),
 value = c(10, 5, 1, 8, 2, 5, 5),
 stringsAsFactors=FALSE)
gganatogram(data=organPlot, fillOutline='#a6bddb',
 organism='human', sex='male', fill="colour")
#We can also remove the outline
oplot = gganatogram(data=organPlot, outline=FALSE, fillOutline='#a6bddb',
organism='human', sex='male', fill="colour")
oplot
oplot + facet_wrap(~type)
library(dplyr)
organPlot %>%
     dplyr::filter(type %in% 'circulation') %>%
 gganatogram(fillOutline='#a6bddb', organism='human',
 sex='male', fill="colour")
organPlot %>%
     dplyr::filter(type %in% c('circulation', 'nervous system')) %>%
 gganatogram(fillOutline='#a6bddb', organism='human',
 sex='male', fill="value") +
 theme_void() +
 scale_fill_gradient(low = "white", high = "red")
#Use hgMale_key to find all tissues to plot
hgMale_key = gganatogram::hgMale_key
head(hgMale_key)
all_tissues = gganatogram(data=hgMale_key, fillOutline='#a6bddb',
organism='human', sex='male', fill="colour")
all_tissues + theme_void()
all_tissues + theme_void() + facet_wrap(~type, ncol=3)
col_fill = gganatogram(data=hgMale_key, fillOutline='#a6bddb',
organism='human', sex='male', fill="colour")
col_fill
val_fill = gganatogram(data=hgMale_key, fillOutline='#a6bddb',
organism='human', sex='male', fill="value")
val_fill
col_fill +facet_wrap(~type, ncol=3) + theme_void()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.