1

How can I specify the bin width for just one histogram?

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

enter image description here

Jim G.
  • 15,141
  • 22
  • 103
  • 166
  • 1
    the easiest way is to change the ggmatrix. ie `gg <- ggpairs(...`, then `gg[3,1] <- gg[3,1] + geom_histogram( binwidth = 50) ; gg` – user2957945 Sep 15 '16 at 10:45
  • if you are only wanting to change it in one facet, then overwrite that cell along the lines of http://stackoverflow.com/questions/17271968/different-breaks-per-facet-in-ggplot2-histogram – user2957945 Sep 15 '16 at 10:48

1 Answers1

3

As @user2957945 mentioned:

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
Community
  • 1
  • 1
Jim G.
  • 15,141
  • 22
  • 103
  • 166