ggplot() +
# blue plot
geom_point(data=Cen, aes(x=log(area[MainIsl == "Main"&organism == "Plant"]), y=log(native[MainIsl == "Main"&organism == "Plant"]))) +
geom_smooth(data=Cen, aes(x=log(area[MainIsl == "Main"&organism == "Plant"]), y=log(native[MainIsl == "Main"&organism == "Plant"])), fill="blue",colour="darkblue") +
# red plot
geom_point(data=Cen, aes(x=log(area[MainIsl == "Main"&organism == "Plant"]), y=log(exotic[MainIsl == "Main"&organism == "Plant"]))) +
geom_smooth(data=Cen, aes(x=log(area[MainIsl == "Main"&organism == "Plant"]), y=log(exotic[MainIsl == "Main"&organism == "Plant"])), fill="red",colour="red")
I used the above code but R gave me an error. The data set I have contains columns: MainIsl(Mainland or island), organisms(Plant or bird), # of natives, # of exotics, total #, and area.
I want to plot area against #of natives, exotics, and total, based on its organism and MainIsl. I want to put points belongs to the same MainIsl and the same organism all together in one plot, different color indicating whether the point is showing #natives or exotics or total.
Is this a correct way to implement this idea using ggplot?