I have a dataframe called PSCfull1 with 3 columns: Gene, OrganoidCM, ControlCM. "Gene" is a list of genes, and the other 2 columns have numerical values. I made a scatterplot with:
ggplot(PSCfull1, aes(x=OrganoidCM, y=ControlCM))+geom_point(size=2, shape=16)+geom_text(label=rownames(PSCfull1))
It looks great, but the labels are numbers instead of the names of the genes from column 1. How can I get the labels to be names rather than row numbers? Thanks!
You should tell ggplot that the labels are held in your Gene column:
ggplot(PSCfull1, aes(x = OrganoidCM, y = ControlCM, label = Gene)) +
geom_point(size=2, shape=16) +
geom_text()
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.