The way to color bar graph - colour,fill,scale_fill_brewer,scale_fill_manual
1. geom_bar(colour=, fill=) colour= color the border of graph fill= fill the graph > ggplot(data=mpg,aes(x=cyl))+geom_bar()> ggplot(data=mpg,aes(x=cyl))+geom_bar(fill="blue")> ggplot(data=mpg,aes(x=cyl))+geom_bar(fill="white",colour="blue") 2. fill graphs separately by a variable. -geom_bar(x=, y=, fill= 'a variable')-geom_bar()+scale_fill_brewer-geom_bar()+scale_fill_manual >library(ggplot2) >l..
2020. 8. 14.
(R)ways to draw curve (function) -curve(), ggplot()
1. exponential distribution > curve(dexp(x,rate=2),from=0,to=6) >ggplot(data.frame(x=c(0,6)),aes(x=x))+stat_function(fun=dexp,args=list(rate=2)) 2. Normal distribution > curve(dnorm(x,mean=5,sd=1),from=-10,to=10) >ggplot(data.frame(x=c(-10,10)),aes(x=x))+stat_function(fun=dnorm,args=list(mean=5,sd=1)) 3. T distribution >curve(dt(x,df=3),from=0,to=10) >ggplot(data.frame(x=c(0,10)),aes(x=x))+stat_..
2020. 8. 13.