Graphics Reference
In-Depth Information
Figure 5-31. Left: a scatter plot with vjust=0; right: with a little extra added to y
It often makes sense to right- or left-justify the labels relative to the points. To left-justify, set
hjust=0 ( Figure 5-32 , left), and to right-justify, set hjust=1 . As was the case with vjust , the
labels will still slightly overlap with the points. This time, though, it's not a good idea to try to
fix it by increasing or decreasing hjust . Doing so will shift the labels a distance proportional to
the length of the label, making longer labels move further than shorter ones. It's better to just set
hjust to 0 or 1, and then add or subtract a bit to or from x ( Figure 5-32 , right):
sp + geom_text(aes(label = Name), size = 4 , hjust = 0 )
sp + geom_text(aes(x = healthexp + 100 , label = Name), size = 4 , hjust = 0 )
Search WWH ::




Custom Search