library(ggplot2)
library(gridExtra)
## Loading required package: grid
summary(diamonds$price)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 326 950 2401 3933 5324 18820
plot1 <- ggplot(diamonds,aes(x=price))+
geom_histogram(color='blue',fill = 'blue')+
scale_x_continuous(breaks=seq(300,19000,1000),limit=c(300,19000))+
ggtitle('Price')
plot2 <- ggplot(diamonds,aes(x=price))+
geom_histogram(color='red',fill='red')+
scale_x_log10(breaks=seq(300,19000,1000),limit=c(300,19000))+
ggtitle('Price(log10)')
grid.arrange(plot1,plot2,ncol=2)
## stat_bin: binwidth defaulted to range/30. Use 'binwidth = x' to adjust this.
## stat_bin: binwidth defaulted to range/30. Use 'binwidth = x' to adjust this.
You can also embed plots, for example:
Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.