# X-axis label: bold, red, and 20 points # X-axis tick marks: rotate 90 degrees CCW, move to the left a bit (using vjust, # since the labels are rotated), and 16 points bp + theme(axis.title.x = element_text(face="bold", colour="#990000", size=20), axis.text.x = eleme...
axis.text.x = element_blank(), panel.border = element_blank(), plot.margin = unit(c(1,2,1,2), "cm")) library(dplyr) theme_set(theme_classic()) source_df <- read.csv("https://raw.githubusercontent.com/jkeirstead/r-slopegraph/master/cancer_survival_rates.csv") # Define functions...
ggplot(housing,aes(x=State,y=Home.Price.Index))+theme(legend.position="top",axis.text=element_text(size=6))+geom_point(aes(color=Date),alpha=0.5,size=1.5,position=position_jitter(width=0.25,height=0)))+scale_color_continuous(name="",breaks=c(1976,1994,2013),labels=c("'76","'94",...
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")) ## Loading required package: plyr head(df3...
max<-range(L.minor$conc)[2] line.data <-data.frame(conc=seq(min,max, length.out=1000)) #用模型预测数据构建数据集 line.data$p.predict <-predict(L.minor.m1, newdata=line.data) require(ggplot2) M_Mfunction <-ggplot()+ geom_point(aes(x=conc, y=rate), data=L.minor, ...
# Define size range sp2 + geom_text(aes(size=wt)) + scale_size(range=c(3,6)) Add a text annotation at a particular coordinate The functions geom_text() and annotate() can be used : # Solution 1 sp2 + geom_text(x=3, y=30, label="Scatter plot") # Solution 2 sp2 + annotate...
# Define size range sp2 + geom_text(aes(size=wt)) + scale_size(range=c(3,6)) Add a text annotation at a particular coordinate The functionsgeom_text()andannotate()can be used : # Solution 1 sp2 + geom_text(x=3, y=30, label="Scatter plot") # Solution 2 sp2 + annotate(geom=...
# Define functions. Source: https://github.com/jkeirstead/r-slopegraph tufte_sort <- function(df, x="year", y="value", group="group", method="tufte", min.space=0.05) { ## First rename the columns for consistency ids <- match(c(x, y, group), names(df)) df <- df[,ids] na...
ggplot is the base layer or object that you use to define the components of your chart (x and y axis, shapes, colors, etc.). You can combine it with layers (or geoms) to make complex graphics with minimal effort. Parameters --- aesthetics : aes (ggplot.components.aes.aes) aesthetics...
An implementation of the Grammar of Graphics in R. Contribute to tidyverse/ggplot2 development by creating an account on GitHub.