我有一组中等规模的数据,正在尝试可视化nrow(df)=7810。为了减少过度绘制,我使用了alpha=.3. 这显着减慢了 R 生成数字所需的时间。这是我的规格,
OS Name Microsoft Windows 10 Home
Version 10.0.18362 Build 18362
Processor Intel(R) Core(TM) i7-2600K CPU @ 3.40GHz, 3401 Mhz, 4 Core(s), 8 Logical Processor(s)
Installed Physical Memory (RAM) 32.0 GB
System Type x64-based PC
R version 3.6.1 (2019-07-05) -- "Action of the Toes"
ggplot2 version 3.2.1
Run Code Online (Sandbox Code Playgroud)
这是正在发生的事情的一个示例,
> p <-ggplot(df, aes(x=x))
> t1<-function(){p + geom_point(aes(y=y), shape=4, size=.5)}
> t2<-function(){p + geom_point(aes(y=y), shape=4, size=.5, alpha=.3)}
> system.time(print(t1()))
user system elapsed
0.14 0.37 0.53 …Run Code Online (Sandbox Code Playgroud)