This graph is part of a research project from a spent fuel nuclear pond
The input file is a table where the relative abundance of genera (calculated in Excel) in 10 samples is represented. An additional column represents the condition indoor or outdoor
The input was created and manipulated in Excel (to calculate the average relative abundance) and then saved as a CSV file. Here is a table of the input file:
library(ggplot2)
library(reshape2)
library(tidyr)
library(dplyr)
pc = read.csv("phylaT.csv", header = TRUE)
pcm = melt(pc, id = c("Samples", "Condition"))
In this particular case, I added this step to keep the order set on the columns to show the abundance of others at the bottom of the graph
pcm$Sample <- factor(pcm$Sample,levels=unique(pcm$Sample))
xx = ggplot(pcm, aes(x = Sample, y = variable)) +
geom_point(aes(size = value, fill = Condition), alpha = 0.75, shape = 21) +
scale_size_continuous(limits = c(0.000001, 100), range = c(1,10), breaks = c(1,10,50,75)) +
labs( x= "", y = "", size = "Relative Abundance (%)", fill = "Condition") +
theme(legend.key=element_blank(),
axis.text.x = element_text(colour = "black", size = 12, face = "bold", angle = 90, vjust = 0.3, hjust = 1),
axis.text.y = element_text(colour = "black", face = "bold", size = 9),
legend.text = element_text(size = 10, face ="bold", colour ="black"),
legend.title = element_text(size = 11, face = "bold"), panel.background = element_blank(),
panel.border = element_rect(colour = "black", fill = NA, size = 1.2),
legend.position = "right", panel.grid.major.y = element_line(colour = "grey95")) +
scale_fill_manual(values = c("pink", "green"), guide = guide_legend(override.aes = list(size=5))) +
scale_y_discrete(limits = rev(levels(pcm$variable)))
xx
In some versions of R Studio, it is possible to export the graph as PDF or JPG, however, in my particular case the quality is not the best, hence I saved the file with the following script:
ggsave("Bubble_plot_more.png", width = 8, height = 6, dpi = 300)
This is the resulting graph. Feel free to change the settings