0

I have a dataset where I want to plot Y and log(Y) against the same X axis , is there any way to have the two charts y ~ X , log(y) ~ X in the same image side by side so that I can compare them.

Sample dataset

datastart <- data.frame(x=rep(1:5,2),
    y=c(1,2,10,50,1, .1,9,8,20,19),
    type=rep(c(‘a’,’b’),each=5))
av abhishiek
  • 647
  • 2
  • 11
  • 26

1 Answers1

1

Something like this?

library(gridExtra)
library(ggplot2)

p1 <- ggplot(datastart,aes(x,y)) + geom_point()
p2 <- ggplot(datastart,aes(x,log(y))) + geom_point()

png(filename="datastart.png")
grid.arrange(p1,p2,ncol=2)
dev.off()
timfaber
  • 2,060
  • 1
  • 15
  • 17