例如:p+theme(legend.position=”left”) 修改legend.tittle内容 p+scale_colour_hue("what does it eat?",breaks=c("herbi","carni","omni",NA),labels=c("plants","meat","both","don't know")); 修改尺寸大小 p+theme(legend.background=element_rect(colour="purple",fill="pink",size=3,lin...
# beside = F,按列并列 barplot(d, beside = T, col = rainbow(2, alpha = 0.3)) legend("topright",legend= c("VIP作品", "大众作品"), fill = rainbow(2, alpha = 0.3), cex = 0.8) ggplot复刻 ggplot(a, aes(x = 小说类别, y = V1, fill = 小说性质)) + geom_bar(stat = "iden...
复制 ggplot(mpg,aes(displ,hwy,shape=drv,colour=cty,size=year))+geom_point(aes(alpha=cyl))+guides(colour=guide_colourbar(position="bottom"),size=guide_legend(position="top"),alpha=guide_legend(position="inside"))+theme(legend.position="left") 案例2 自动设置刻度图长度 代码语言:javascript 复...
(), panel.grid.major = element_line(color = "gray97"), plot.title = element_text(face = "bold", size = 14, hjust = 0), plot.subtitle = element_text(size = 12, hjust = 0), legend.position = c(0.85,1.09), legend.background = element_blank(), legend.text = element_text(...
# geom_vline(aes(xintercept=0.5), colour="red", linetype="dashed", size=0.2) + scale_color_manual(values=c("#619CFF","lightgrey","#F8766D")) + scale_fill_manual(values=c("blue","lightgrey","red")) + scale_y_continuous(position="left", breaks =seq(0, 15, by = 5), li...
Main title, axis labels and legend title Legend position and appearance Change colors automatically and manually Point shapes, colors and size Add text annotations to a graph Line types Themes and background colors Axis scales and transformations ...
axis.ticks = element_line(size = .8), #去除图例标题 #legend.title = element_blank(), #设置刻度label的边距 axis.text.x = element_text(margin=unit(c(0.5,0.5,0.5,0.5), "cm")), axis.text.y = element_text(margin=unit(c(0.5,0.5,0.5,0.5), "cm"))) ...
panel.grid.major.x=element_line(), axis.ticks=element_blank(), legend.position="top", panel.border=element_blank()) plot(gg) 4. 分布图 有很多数据点 想研究怎么分布 直方图 只有一个变量 geom_bar()会计算每种变量的数量 stat=identity 选项一定要设置 而且x和y轴的变量都要提供 Histogram on a...
theme(legend.text=element_text(face ="bold"), #图例的PM2.5、NO2字体改成bold字体 legend.position = "top", #图例位置改为图上方 legend.title=element_blank(), #隐藏图例“pollutant" strip.text = element_text(face ="bold",size = 10), #设置单个图的类别标题文本的字体及大小(即小图中的“北...
(2, 10) df <- data.frame(x=x, y=y, fac=fac) p <- ggplot(df, aes(x=x, y=y, linetype=fac)) + geom_line() + geom_segment(aes(x=2, y=7, xend=7, yend=7), colour="red") + scale_linetype_discrete(guide=guide_legend(override.aes=aes(colour="blue"))) fig <- ...