Entering edit mode
7.4 years ago
Kamil ★ 2.2k
ggrepel is an R package that provides geoms to repel overlapping text labels away from each other in a plot created by ggplot2.
Install the stable release from CRAN:
Or, install the latest development version from github:
See the vignette for more usage examples:
ggplot(mtcars) + geom_point(aes(wt, mpg), color = 'red') + geom_text_repel(aes(wt, mpg, label = rownames(mtcars))) + theme_classic(base_size = 16)
You might want to indicate that it's dependant on ggplot2 version 2.0+, as it took a while for me to figure out why it was silently failing to install.
Thanks for catching this! I missed it.
Thank you, Thank you. A million times thank you.
Well done! This great!
great implementation regarding the text labels, especially for volcano plots with a lot of gene symbols !! I have only one small question: if still with the similar code above, I have still some text labels not clearly shown, by which arguments can I control or improve the distance between these possible overlapping layers ?
Efstathios, thanks for your question!
Please see if the examples in the vignette might help to learn about the arguments. Try 'box.padding'.
If you need further help, could I ask you to continue this discussion in a new issue on the github repo? If you do not use github, feel free to create a new post on this page, under "Add your answer". Consider sharing a code example and an image of the plot to clarify the problem.
i will check first the additional capabilities and your suggestions-if i continue having issues, i will post the code and a supportive image !!
Thanks for the ggrepel Kamil. I also suggested this to someone last month
Dear Kamil, Thanks a lot for the ggrepel!
One question: is it possible to remove linking lines between datapoints and labels that are close to each other, e.g. for Chrysler Imperial (bottom right corner) or Toyota Corolla (top left corner) on your example. This will make the plot even nicer.
Thanks in advance, Grant