ggnewscale tries to make it painless to use multiple scales in ggplot2. Although originally intended to use with colour and fill, it should work with any aes, such as shape, linetype and the rest.ggnewscale: spend 400% more time tweaking your ggplot!
ggnewscale::new_scale_color() + geom_abline(aes(intercept = intercept, slope = slope,colour = slope), data = temp.data, size =1.5) + scale_x_continuous(limits = c(0,300)) + scale_y_continuous(limits = c(0,300)) ## Scale for 'x' is already present. Adding another scale for ...
scale_x_binned(name = expression(1+exp(2))) p2 <- ggplot(mtcars) + geom_bar(aes(mpg)) + scale_x_binned() + labs(title = "This is example", tag = "A", x = expression(1+exp(2))) p3 <- ggplot(mtcars) + geom_bar(aes(mpg)) + scale_x_binned(name = expression(1+exp(2...
双y坐标轴的图绘制原理还是相当简单的,就是将次坐标轴的取值范围映射为主坐标轴的取值范围,然后再利用ggplot2中scale_y_continuous函数的sec.axi参数,设置一下次坐标的数据即可。另外,ggnewscale作为扩展包,可以用来解决美学映射冲突的问题,例如在一张图上使用多个独立且相同的颜色、形状等映射体系。
其实只需要使用new_scale("fill")类似的函数进行分隔即可(这个函数需要定义,见后),然后再分别进行颜色的调整就会冲突了,很简单的。 例如: ggplot(data = data,aes(x=x,y=y)) + # 图层1 点图 geom_point(aes(color=gene1)) + scale_colour_gradient(low='grey',high='#32a676',name='legend1_scatter...
:exclamation: This is a read-only mirror of the CRAN R package repository. ggnewscale — Multiple Fill and Colour Scales in 'ggplot2'. Homepage: https://eliocamp.github.io/ggnewscale/, https://github.com/eliocamp/ggnewscale Report bugs for this package
(clip="off")+ggnewscale::new_scale_fill()+geom_tile(data=waxy_snp,aes(x=x_location,y=y_location,fill=type),width=100)+scale_fill_manual(values=c("#ffccff","#99ccff"),labels=c("Alternative type","Reference type"))+geom_text(data=waxy_snp,aes(x=x_location,y=y_location,label=...
ggnewscale::new_scale_fill()+ geom_area(data=df2,aes(x=x1,y=y1,fill=var), #fill="blue", alpha=0.8)+ scale_fill_manual(values = c("#ff8e54","#f63c50","#0088bf","#77d793", "#e1f594","#ffffbe","#ffe087"))+
(0.3,15.7))+ggnewscale::new_scale_fill()+geom_ribbon(data=new.dat02,aes(x=x,ymin=y1,ymax=y3,fill=group,color=group),alpha=0.2)+geom_line(data=new.dat02,aes(x=x,y=y2,color=group),show.legend=FALSE)+scale_fill_manual(values=c("#00b0eb","#e20612"),name="AAA")+scale_...
ggnewscale 实现在ggplot2中使用多种颜色和填充比例。目前只是实验性阶段,所以使用风险自负! Python开发-CMS内容管理系统2019-08-10 上传大小:126KB 所需:42积分/C币 libxml2-python-2.6.11.rpm(好不容易找到的) libxml2-python-2.6.11.rpm包下载(好不容易找到的),希望对你有用!