Các code được thực hiện như sau:
# > rungtrong
# >attach(rungtrong)
# >head(rungtrong)
# library(ggExtra)
# library(plot3D)
>
p=scatter=ggplot(data=rungtrong, aes(x=d,y=h,color=dd))+geom_point(size=2)+
theme_bw(base_size=15)+theme(legend.position="none")+ggtitle("Fig.
1")+ xlab("D1.3, cm")+ ylab("Hvn, m")
# Tiếp
> p1=Hvndensity=ggplot(data=rungtrong,
aes(x=h,fill=dd))+geom_density(alpha=0.5)+theme_bw()+
coord_flip()+xlab("Hvn, m")+ ggtitle("Fig. 2")
> grid.arrange(Ddensity, blank1, scatter, Hvndensity, ncol=2, nrow=2,
widths=c(4,3), heights=c(2,4))# result Fig.2
# Tiếp theo
> p2=Ddensity=ggplot(data=rungtrong,
aes(x=d, fill=dd))+
geom_density(alpha=0.5)+theme_bw()+theme(legend.position="none")+
ggtitle("Fig. 3")+ xlab("D1.3, cm")
# Tiếp theo
> blank1=ggplot()+geom_blank(aes(1,1)+
theme(plot.background=element_blank(), panel.grid.major=element_blank(),
panel.grid.minor=element_blank(), panel.border=element_blank(),
panel.background=element_blank(), axis.title.x=element_blank(),
axis.title.y=element_blank(), axis.text.x=element_blank(),
axis.text.y=element_blank(), axis.ticks=element_blank(),
axis.line=element_blank()))
# result
Fig.4
0 comments:
Post a Comment