I wish to print the relative abundance of certain phylum in a ggplot stacked barchart with a legend that showed the corresponding kingdom and phylum following /questions/70830042/grouping-legend-by-higher-classification-filum-and-genus-ggplot2
your text
Phylum_Depth_Bar+geom_text(aes(x=Depth,y=Percentage_of_Phylum,label=ifelse(summed_percentage_data$Percentage_of_Phylum> 0, sprintf(“%.2f”, Percentage_of_Phylum), “”)), color =ifelse(summed_percentage_data$Percentage_of_Phylum > 5, “black”, “transparent”),
size = 3.5, family=”serif”, position = position_stack(vjust = 0))
#set criteria for label color, if >x, show black color, else show transparent to take up alignment margin
both resulted in compressed barchart
enter image description here
need some help to combine both the separated legends and the criteria-ed geomtext()
Thanks in advance
I wish to get something of the combination of enter image description hereenter image description here
Jiayong Lai is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.