How to create Anatogram plot in R

[This article was first published on Data Science Tutorials, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

The post How to create Anatogram plot in R appeared first on Data Science Tutorials

What do you have to lose?. Check out Data Science tutorials here Data Science Tutorials.

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()

The post How to create Anatogram plot in R appeared first on Data Science Tutorials

Learn how to expert in the Data Science field with Data Science Tutorials.

To leave a comment for the author, please follow the link and comment on their blog: Data Science Tutorials.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)