Hello,
I saw these figures in a paper and wanted to make a similar graphs. Is there a function to do this kind of line graph in R that you would recommend?
I have a list of genes and would need to run go term enrichment on them, then obtain some p-values so that they can be represented as circle size on the graph.
Your input is appreciated, thank you.
1 answer
Sure, you can just call both geom_point() and geom_line(). If you want to make them look exactly like the authors, I'd probably pass group into the main aes() call and "size = -log10(p-value)" into the aes() call just for geom_point()
Edit: I agree with rpolicastro, but I just realized you should also add color to the main aes() also. Copying his example, now with a fourth column called tissue:
ggplot(data, aes(x=day, y=fold_change, color = tissue)) +
geom_line() +
geom_point(aes(size=-log10(pval)))
Log in to answer this question.
Speaking generically since you didn't provide example data, you would minimally start off with a 3 column data frame
dfwith columnsfold_change,pval, and what I assume isday.Your call to ggplot would then look something like.
Adding additional lines and such would require dataset specific modifications to the input data or ggplot call, but I won't cover those since example data and desired output wasn't provided.
I explained in this 👉 post. Please refer.
Apparently, you can also use this online tool -> https://cparsania.shinyapps.io/FungiExpresZ/ to generate such plot with few clicks