Using ggrepel to plot non-overlaying texts
Remember the times you wanted to plot texts or labels but feared that they would overlay? Fear no more, your troubles have met a sad end with ggrepel
. This wonderful package shifts the text while adding a line segment to tell the audience from what place the text had come from.
This is wonderful for several reasons. When you want to plot pure text but over plotting is spoiling it or when text from your bubble plot is stealing the attention from some really small points, here is the solution. To understand it, we are back to our Armada bubble
plot.
Getting Ready
Besides downloading ggrepel
--as we are back to our armada plot--we need the HistData
package again, so run the following:
> if(!require(ggrepel)){install.packages('ggrepel')} > if(!require(HistData)){insertClassMethods('HistData')}
If everything went fine, you're are now locked and loaded.
How to do it...
For this recipe, we will be drawing a bubble plot and afterward making sure that the...