
上QQ阅读APP看书,第一时间看更新
How to do it...
- Set shape to '.' in order to reduce points using ggplot2:
> library(ggplot2)
> sca5 <- ggplot(diamonds, aes(x = carat, y = price))
> sca5 + geom_point(shape = '.')
Result looks like the following:

Figure 2.5 - Diamonds price versus cara with very small points.
- plotly is also able to achieve similar results by declaring the marker argument:
> library(plotly)
> sca6 <- plot_ly(diamonds, x = ~carat, y = ~price, type = 'scatter',
mode = 'markers', marker = list(size = .8))
> sca6
- Using ggvis, this change is done by the size argument:
> library(ggvis)
> sca7 <- diamonds %>% ggvis(x = ~carat, y = ~price)
> sca7 %>% layer_points( size := .5)
Explanations on sight, sailors!