首页 热点资讯 义务教育 高等教育 出国留学 考研考公
您的当前位置:首页正文

ggplot2 advanced

2024-12-20 来源:化拓教育网

ggplot2 advanced

@(R)[graph]

Axes control

x axis as Date

scale_x_date(limits = as.Date(c("2012-10-01","2013-09-24")),labels = date_format("%m-%d"))

axis as numaric

+ scale_y_continuous(labels = comma) 

XY axes look

last_plot() #上面画的图+  
theme(plot.title = element_text(size=20,colour = "blue",face = "bold"), 
axis.title.x = element_text(size=15,colour = "black",face = "bold"), 
axis.text.y = element_text(colour = "red"), 
axis.line = element_line(colour = "red",size = 5), 
panel.grid.major = element_line(colour="red")) 
# 标题设置为"大小20,蓝色,加粗;X标题设置为"大小15,黑色,加粗",Y的标签设置为"红色" 

Set personal style

xquiet <- scale_x_continuous("",breaks = NULL) 
yquiet <- scale_y_continuous("",breaks = NULL) 
quiet <- xquiet + yquiet 
p <- ggplot(data = x,aes(dt,click,colour = "blue")) + quiet
显示全文