Graphics Reference
In-Depth Information
For both of these methods, if you manually specify the range, and there is a bin that falls outside
that range because it has too many or too few points, that bin will show up as grey rather than
the color at the high or low end of the range, as seen in the graph on the right in Figure 5-15 .
Figure 5-15. Left: binning data with stat_binhex(); right: cells outside of the range shows in grey
Overplotting can also occur when the data is discreteon one or both axes, as shown in Fig-
ure 5-16 . In these cases, you can randomly jitterthe points with position_jitter() . By de-
fault the amount of jitter is 40% of the resolution of the data in each direction, but these amounts
can be controlled with width and height :
sp1 <- ggplot(ChickWeight, aes(x = Time, y = weight))
sp1 + geom_point()
sp1 + geom_point(position = "jitter" )
# Could also use geom_jitter(), which is equivalent
sp1 + geom_point(position = position_jitter(width = .5 , height = 0 ))
Search WWH ::




Custom Search