不喜欢ggplot2,R老年人可以试试ggfree!
R 语言的可视化主要包括基础图形系统(base R)、lattice 图形系统和 ggplot2 图形系统。
R老年人,作为老一辈长期使用base R图形系统建图表的用户,可能会觉得 ggplot2 的语法不够直观且有些别扭。
ggfree号称“使用R的基础图形系统(base R )生成类似ggplot2 风格的图表,而无需依赖ggplot2的代码或语法--The overall purpose of ggfree is to make it easier to generate plots in the style of ggplot2 and its extensions, without ever actually using any ggplot2 code.”
看几个案例,
系统发育树
支持多种树布局算法(矩形、倾斜、无根等),用于绘制系统发育树,类似 ggtree 的功能。
set.seed(1999); phy <- rtree(50)
par(mfrow=c(2,2))
# default rectangular layout with "time" axis
plot(tree.layout(phy)); axis(side=1)
# slanted layout with unscaled branches
plot(tree.layout(phy, type='s', unscaled=T))
# radial layout with node labels
plot(tree.layout(phy, type='o'), label='b', cex.lab=0.6)
# equal-angle (unrooted) layout without labels
plot(tree.layout(phy, type='u'), label='n')
更复杂一点的,
斜率图
用于展示数值随时间线的变化等。
par(family='Palatino') # use a fancier font
# the actual code here
slopegraph(co2.emissions, type='t', cex.text=0.6, names.arg=c(2000, 2010))
# make a nice title
title(expression(text=paste('CO'[2], ' emissions (metric tons) per capita')),
cex=0.7)
极坐标图
pal <- brewer.pal(3, 'Pastel2')
# load the Florence Nightingale data set (note, need to install HistData)
require(HistData)
#> Loading required package: HistData
ng <- subset(Nightingale, Year==1855, c('Wounds.rate', 'Other.rate', 'Disease.rate'))
row.names(ng) <- Nightingale$Month[Nightingale$Year==1855]
par(mar=rep(0,4))
# the actual plotting function
polarplot(as.matrix(ng), x=0.2, y=0.3, theta=1.1*pi, col=pal,
use.names=T)
# add some nice labels
title('Causes of mortality in British army, Crimean War (1855)',
font.main=1, family='Palatino', line=-3)
legend(x=-0.8, y=0.6, legend=c('Wounds', 'Other', 'Disease'), bty='n',
fill=pal, cex=0.9)
。。。。。不一一介绍了!
小编简单说几句,
ggfree更新缓慢、功能覆盖有限、社区支持较弱,口号大,雨点小,难以匹配ggplot2的灵活性和生态优势,可以放弃使用了~~
作为ggplot2忠实粉丝,还是使用ggplot2吧!
-推荐阅读-
👉matplotlib教程:20w字+数百张图形+1W行代码+详细代码注释+学习交流群
👉seaborn教程:12.3万字+500多张图形+8000行代码
如何加入学习?
👇(请备注:428)