panel.grid.major = element_blank(), panel.grid.minor = element_blank(), axis.line = element_line(colour = “gray”), plot.title = element_text(hjust = 0.5), plot.subtitle = element_text(hjust
For example, to set a bold ggplot title, use this: p + theme(plot.title = element_text(face = "bold")). The allowed values for the font face include: “plain”, “italic”, “bold” and “bold.italic”. Change title position to the center or to any other locations (left, right...
easy_center_title(). Want to rotate x-axis labels 90 degrees? easy_rotate_labels(which = “x”). Learn more about the package in the InfoWorld ggeasy tutorial or the video below. ggeasy is by Jonathan Carroll and others and is available on CRAN. Highlight items in your plots: gghigh...
cty_mpg$make <- factor(cty_mpg$make, levels = cty_mpg$make) # to retain the order in plot. library(ggplot2) theme_set(theme_bw()) # Draw plot ggplot(cty_mpg, aes(x=make, y=mileage)) + geom_bar(stat="identity", width=.5, fill="tomato3") + labs(title="Ordered Bar Chart"...
binaxis ="y", stackdir ="center") + stat_summary(fun.data="mean_sdl") ## Bin width defaults to 1/30 of the range of the data. Pick better value with `binwidth`. errorbar df3 <- data_summary(mpg, varname="hwy", grps= c("cyl")) ...
# Scatterplot# 画散点图gg<-ggplot(midwest,aes(x=area,y=poptotal))+geom_point(aes(col=state,size=popdensity))+# 画平滑曲线geom_smooth(method="loess",se=F)+xlim(c(0,0.1))+ylim(c(0,500000))+labs(subtitle="Area Vs Population",y="Population",x="Area",title="Scatterplot",caption=...
(0.8)), legend.text.align = NULL, legend.title = element_text(size = rel(0.8), face = "bold",hjust=0), legend.title.align = NULL, legend.position = "right", legend.direction = NULL, legend.justification = "center", legend.box = NULL, panel.background = element_rect(fill = "...
stackdir='center', dotsize = .5, fill="red") + theme(axis.text.x = element_text(angle=65, vjust=0.6)) + labs(title="Box plot + Dot plot", 图片 Tufte 箱型图 library(ggthemes) library(ggplot2) theme_set(theme_tufte()) # from ggthemes ...
legend.title = element_text(size = rel(0.8), face ="bold", hjust =0), legend.title.align =NULL, legend.position ="right", legend.direction =NULL, legend.justification ="center", legend.box =NULL, panel.background = element_rect(fill ="grey90", colour =NA), ...
可以用boundary或者center指定某一个条形的边界或者中心, 用breaks指定所有分点位置。 如 p+geom_histogram(bins =15, boundary =0.0025) 可以将直方图画成连线形式,用geom_freqpoly()函数,如上图可以改为: p+geom_freqpoly(bins =15, boundary =0.0025) ...