Note that, the functionsscale_color_continuous()andscale_fill_continuous()can be used also to set gradient colors. 注意,缩放函数的颜色连续()和缩放填充连续()也可以用来设置渐变颜色。 Gradient between n colors N 个颜色之间的渐变 # Scatter plot # Color points by the mpg variable sp3<-ggplot(mtc...
color=Tree))+geom_point()+geom_line(size=1)+##线条粗细scale_color_brewer(palette="Set1")+ ...
x = "Day")+ scale_x_continuous(limits = c(0,60),expand = c(0,0))+geom_hline(yinte...
p2 <- ggplot(df, aes(x, y)) + geom_point(shape=21, color = "purple", fill = "cyan", size = 5) p2 + scale_y_continuous(labels = scales::percent) # y轴百分号显示 p2 + scale_x_continuous(labels = scales::comma) + # 数字逗号分割,每3位数增加1个逗号 scale_y_continuous(labels ...
() # Color by groups p2 <- sp2 + geom_text(aes(color=factor(cyl))) # Set the size of the text using a continuous variable p3 <- sp2 + geom_text(aes(size=wt)) # Define size range p4 <- sp2 + geom_text(aes(size=wt)) + scale_size(range=c(3,6)) wrap_plots(p1, p2, ...
# map color to continuous variable qplot(curb.weight, price, data=auto.data, color=bore) Scatter Plots Aesthetics There are many other aesthetics besides color. Some we’ll encounter are: Not all aesthetics work with both categorical and continuous variables (like color did) ...
scale_color_gradient():用于两种颜色之间的顺序渐变 scale_color_gradient2():用于分散梯度 scale_color_gradientn():用于n种颜色之间的渐变 Rplot02.png 3.2. 手动更改配色 #Changecolors manually #Boxplot m<-bp+scale_fill_manual(values=c("#999999","#E69F00","#56B4E9"))#Scatterplot ...
numeric(Date), y = value, color = variable),size = 1)+ #scale_x_continuous(breaks = c(seq(-1,1,0.25),as.numeric(date)[date_breaks]), # labels = c(as.character(seq(-1,1,0.25)),date_labels[date_breaks]))+ scale_color_manual(values = c('blue','green'))+ theme_bw()+ ...
Another continuous variable (by changing the size of points). 一个连续变量 如果你有四维数据 使用气泡图更好 其中两个变量是数值 numeric (X and Y) 一个是类型 categorical (color) 另一个是数值型 numeric variable (size). 提供不同群组间更好的可视化比较效果 1 2 3 4 5 6 7 8 9 10 11 12 ...
geom_dumbbell(color="#a3c4dc", size=0.75, point.colour.l="#0e668b") + scale_x_continuous(label=percent) + labs(x=NULL, y=NULL, title="Dumbbell Chart", subtitle="Pct Change: 2013 vs 2014", caption="Source: https://github.com/hrbrmstr/ggalt") + ...