如何保存ggpairs,因为当前的ggsave不起作用?
脚本:
library(GGally)
library(ggplot2)
data(diamonds, package="ggplot2")
diamonds.samp <- diamonds[sample(1:dim(diamonds)[1],200),]
pf<-ggpairs( diamonds.samp[,1:3],mapping = ggplot2::aes(color = cut))
ggsave("C:/Users/top/Desktop/ggpairs.jpg", pf, dpi=500)
答案 0 :(得分:3)
如果您尝试使用UPDATE
per_days AS p
JOIN requests AS r
ON p.user_id = r.user_id
SET p.AllVisited = p.AllVisited + IF( /* there is a row */, 1, 0),
p.MaxConsecutive = IF( p.LastConsecutive > p.MaxConsecutive, LastConsecutive, MaxConsecutive),
p.LastConsecutive = IF( /* there is a row */, p.LastConsecutive + 1, 1),
p.request_numb = { /* count(1) - the number of all requests (all selected rows) for specific user in this day */ }
WHERE r.unix_time > subdate(now(), interval '1' day)
,则会收到错误
ggsave
在图像中保存7 x 7 UseMethod(“grid.draw”)出错: 没有适用于'grid.draw'的方法应用于类“c('gg','ggmatrix')的对象”
因此,您可以为ggsave("ggpairs.jpg", pf, dpi=500)
对象类
grid.draw
方法
ggpairs