我们的数据可视化课程已经上线啦!!目前课程的主要方向是 科研、统计、地理相关的学术性图形绘制方法,后续也会增加商务插图、机器学等、数据分析等方面的课程。课程免费新增,这点绝对良心!
我们第一个数据可视化交流圈子也已经上线了,主要以我的第一本书籍《科研论文配图绘制指南-基于Python》为基础进行拓展,提供「课堂式」教学视频,还有更多拓展内容,可视化技巧远超书籍本身,书籍修正和新增都会分享到圈子里面~~
参与课程或者圈子的你将获取到:学员答疑、可视化资源分享、可视化技巧补充、可视化业务代做(学员和甲方对接)、副业交流、提升认知等等。
最近在查可视化资料,发现了一个超赞的论文可视化作品,如下:
点击去一看才发现是一个专门介绍可视化工具spiralize的文章,赶紧把这个工具收入收藏夹并分享给大家,下面,小编就给大家介绍下这个超赞的可视化工具包~~
spiralize包是一个沿着阿基米德螺旋将数据可视化展示的R语言拓展工具包。它在可视化方面有两大优势:
spiralize包的安装方法也非常简单,如下:
install.packages("spiralize")
#或者使用以下方式安装最新版本
library(devtools)
install_github("jokergoo/spiralize")
这一小节,小编直接给大家分享该工具包绘制的炫酷可视化案例,其基础的使用语法,读者可自行在其官方进行查看即可。
# the top left plot
spiral_initialize(flip = "none") # default
spiral_track(height = 0.6)
spiral_axis()
# the top right plot
spiral_initialize(flip = "horizontal")
spiral_track(height = 0.6)
spiral_axis()
# the bottom left plot
spiral_initialize(flip = "vertical")
spiral_track(height = 0.6)
spiral_axis()
# the bottom right plot
spiral_initialize(flip = "both")
spiral_track(height = 0.6)
spiral_axis()
# the left plot
spiral_initialize(reverse = FALSE) # default
spiral_track()
spiral_arrow(0.2, 0.8, gp = gpar(fill = "red"))
spiral_axis()
# the right plot
spiral_initialize(reverse = TRUE)
spiral_track()
spiral_arrow(0.2, 0.8, gp = gpar(fill = "red"))
spiral_axis()
spiral_initialize_by_gcoor(xlim = c(2e6, 8e6)) # 2MB to 8MB
spiral_track(height = 0.6)
spiral_axis()
spiral_points(x = runif(500, min = 2e6, max = 8e6), runif(500), pch = 16, gp = gpar(col = 2))
spiral_initialize(xlim = c(0, n), scale_by = "curve_length",
vp_param = list(x = unit(0, "npc"), just = "left"))
spiral_track(height = 0.4)
meth_col = structure(names = unique(df$meth_class), unique(df$meth_col))
spiral_rle(df$meth_class, col = meth_col)
spiral_track(height = 0.4)
tumor_col = structure(names = unique(as.vector(df$tumor_type)), unique(df$tumor_col))
spiral_rle(df$tumor_type, col = tumor_col, labels = TRUE)
lgd_list = tapply(1:nrow(df), df$tumor_type, function(ind) {
Legend(title = df$tumor_type[ind][1], at = unique(df$meth_class[ind]),
legend_gp = gpar(fill = unique(df$meth_col[ind])))
})
# here set max_height to the height of the image so that the legends are automatically arranged
lgd = packLegend(list = lgd_list, max_height = unit(7, "inch"))
draw(lgd, x = unit(1, "npc") + unit(2, "mm"), just = "left")
其他可视化案例如下:
好了,更多关于spiralize包的使用语法和可视化案例,大家可参考:spiralize包官网[1] 参考资料
[1]
spiralize包官网: https://jokergoo.github.io/spiralize/index.html。