似乎无法用ggplot2绘制200,000点

时间:2018-01-31 16:29:34

标签: r ggplot2

我试图用geom_beeswarm绘制大约200,000个点。当我用geom_point绘制而不是geom_beeswarm时,我会得到情节,但这也需要大约30秒。

这是我的代码:

libray(tidyverse)
library(beeswarm)

df_tidy %>%
  ggplot(aes(x = misdrijf, y = verandering_2010_2016)) +
  geom_beeswarm() +
  geom_point(data = filter(df_tidy, regio == "Nederland",
                           jaar == 2016), colour = "#FF9800") +
  coord_flip() +
  theme_minimal() +
  theme(plot.title = element_text(face = "bold"),
        axis.text.x = element_text(size = 10)) +
  annotate("text", x = "6.3 Drugsmisdrijf (overig)", y = -30, label = Annotation_layer_1.1, size = 3) +
  geom_segment(aes(x = "9 Misdrijven overige wetten", y = -30, xend = "9.2 Misdrijf (overig)", yend = -19)) +
  annotate("text", x = "3.3.5 Pornografie", y = -20, label = Annotation_layer_1.2, size = 3) +
  annotate("text", x = "1.3.1 Muntmisdrijf", y = -20, label = Annotation_layer_1.3, size = 3) +
  geom_segment(aes(x = "1.2.2 Flessentrekkerij", y = -20, xend = "1.2 Bedrog", yend = -11.5)) +
  labs(title = "Welk misdrijf per 1000 inwoners is gegroeid of\ngedaald?",
       subtitle = subtitle_1,
       x = "",
       y = "Verandering 2016 tenopzichte van 2010")

我的机器是Macbook pro 2,2 GHz Intel Core i7。

这需要很长时间才正常吗?

0 个答案:

没有答案