0

如何为一个直方图指定 bin 宽度?

library(GGally)
data(tips, package="reshape")

library(ggplot2)
ggpairs(data=tips, # data.frame with variables
        columns=1:3, # columns to plot, default to all.
        title="tips data", # title of the plot
        mapping=aes(color=sex)) # aesthetics, ggplot2 style

在此处输入图像描述

4

1 回答 1

2

正如@user2957945 提到的

library(GGally)
data(tips, package="reshape")

library(ggplot2)
gg <- ggpairs(data=tips, # data.frame with variables
        columns=1:3, # columns to plot, default to all.
        title="tips data", # title of the plot
        mapping=aes(color=sex)) # aesthetics, ggplot2 style
gg[3,1] <- gg[3,1] + geom_histogram( binwidth = 50)
gg
于 2016-09-16T11:46:01.627 回答