How to create Anatogram plot in R
How to create Anatogram plot in R, Anatograms can be produced using the same-named package function.
Keep in mind that you can design your own data frame.
Man
Pass the data frame to the function with the parameters and construct the anatogram of a guy.
Please take note that we utilized to keep dimensions and set a blank theme.
install.packages("remotes") remotes::install_github("jespermaag/gganatogram") library(gganatogram) gganatogram(data = hgMale_key, organism = "human", sex = "male", fill = "colour", fillOutline = "#a6bddb") + theme_void() + coord_fixed()
How to create a ggalluvial plot in R? – Data Science Tutorials
Woman
Anatogram creation for a woman follows a similar procedure to that for a male, except passing the data frame and specifying
library(gganatogram)
gganatogram(data = hgFemale_key,
organism = "human", sex = "female",
fill = "colour", fillOutline = "#a6bddb") +
theme_void() +
coord_fixed()
Zoom
You can utilize it if you need to zoom in on a particular area of the anatogram.
If you want to see the values of the axes, don’t forget to erase the subject.
library(gganatogram)
gganatogram(data = hgMale_key,
organism = "human", sex = "male",
fill = "colour", fillOutline = "#a6bddb") +
coord_cartesian(xlim = c(30, 75), ylim = c(-40, 0)) +
theme_void()
How to Add a caption to ggplot2 Plots in R? (datasciencetut.com)
Systems
You can only choose a small number of body systems; the default graph displays all of them.
You can choose to merely sketch the systems if you like. To view the available options or type.
library(dplyr)
hgMale_key %>%
filter(type %in% "nervous_system") %>%
gganatogram(organism = "human", sex = "male",
fill = "colour", outline = FALSE) +
theme_void() +
coord_fixed()
Organs
You can sketch some organs in a manner similar to how you draw some systems.
library(dplyr) hgMale_key %>% filter(organ %in% c("brain", "heart")) %>% gganatogram(organism = "human", sex = "male", fill = "colour") + theme_void() + coord_fixed()
colour scale
Based on the column of the data frames, the colour scale can be modified by adding a continuous colour scale, like viridis.
library(dplyr)
hgMale_key %>%
filter(organ %in% c("brain", "heart")) %>%
gganatogram(organism = "human", sex = "male",
fill = "colour") +
theme_void() +
coord_fixed()
> library(dplyr)
> library(gganatogram)
> gganatogram(data = hgFemale_key,
+ organism = “human”, sex = “female”,
+ fill = “colour”, fillOutline = “#a6bddb”) +
+ theme_void() +
+ coord_fixed()
Error in alpha(first_rows$fill, first_rows$alpha) :
unused argument (first_rows$alpha)
theme_void() +
+ coord_fixed()
Two times + argument
I’m not a massive user of r, so apologies for what might be a silly question:
The code under “colour scale” is identical to the code used in “organs”. I cannot tell if this is deliberate because the text described modifying the data frames or a simple copy-paste error.
Everything above has worked perfectly though, so enormous thanks