单细胞技术大热,其数据分析里面很重要的一个环节就是可视化,真的是五花八门了!我们在单细胞天地公众号分享过 几百篇单细胞CNS文章阅读笔记,大家可以看得到:
- 单细胞助力分析靶向治疗药物性超敏反应综合征
- 使用scHCL探索单细胞转录组细胞类型
- 溃疡性结肠炎患者的细胞内和细胞间重排
- 一文了解单细胞基因调控网络(GRN)
- 胃癌前病变和早期胃癌的单细胞转录组研究
- ✦ 数据(Data),最基础的是可视化的数据和一系列图形映射(aesthetic mappings),该映射描述了数据中的变量如何映射到可见的图形属性。
- ✦ 几何对象(Geometric objects, geoms)代表在图中实际看到的点、线、多边形等。
- ✦ 统计转换(Statistical trassformations, stats)是对数据进行某种汇总,例如将数据分组创建直方图,或将一个二维的关系用线性模型进行解释。
- ✦ 标度(Scales)是将数据的取值映射到图形空间,例如用颜色、大小或形状来表示不同的取值,展现标度的常见做法是绘制图例和坐标轴。
- ✦ 坐标系(Coordinate system, coord)描述数据是如何映射到图形所在的平面,同时提供看图所需的坐标轴和网格线。
- ✦ 分面(faceting)如何将数据分解为子集,以及如何对子集作图并展示。
- ✦ 主题(theme)控制细节显示,例如字体大小和图形的背景色。
ggplot2作者亲自写的书
链接:https://ggplot2-book.org/facet.html书名是:ggplot2: Elegant Graphics for Data Analysis作者:Hadley WickhamThis is the online version of work-in-progress 3rd edition of “ggplot2: elegant graphics for data analysis”虽然这本书有对应的中文译本,但是时间上相对滞后,建议直接看这个在线实时更新版本。
Getting started
- 1 Introduction
- 2 Getting started with ggplot2
- 3 Frequently asked questions
- II Toolbox
Introduction
- 4 Individual geoms
- 5 Collective geoms
- 6 Statistical summaries
- 7 Maps
- 8 Annotations
- 9 Arranging plots
III The Grammar
- 10 Mastering the grammar
- 11 Build a plot layer by layer
- 12 Scales, axes and legends
- 13 Coordinate systems
- 14 Facetting
- 15 Themes
IV Extending ggplot2
- 16 Programming with ggplot2
- 17 ggplot2 internals
- 18 Writing ggplot2 extensions
- 19 Extension Case Study: Springs, Part 1
- References
知识点参考卡片(速记表,小抄)
链接:https://ggplot2.tidyverse.org/reference/内容如下:- Plot basics
- Layer: geoms
- Layer: stats
- Layer: position adjustment
- Layer: annotations
- Aesthetics
- Scales
- Guides: axes and legends
- Facetting
- Facetting: labels
- Coordinate systems
- Themes
- Programming with ggplot2
- Extending ggplot2
- Vector helpers
- Data
- Autoplot and fortify
sthda网站的ggplot核心图表示例
链接:http://www.sthda.com/english/wiki/ggplot2-essentials书籍本身提供售卖,价格是17欧元,不过内容都是电子化了,大家直接网页浏览,就是免费的哈!内容:- qplot(): Quick plot with ggplot2
- Scatter plots
- Bar plot
- Box plot, violin plot and dot plot
- Histogram and density plots
- Box plots
- Basic box plots
- Box plot with dots
- Change box plot colors by groups
- Change box plot line colors
- Change box plot fill colors
- Change the legend position
- Change the order of items in the legend
- Box plot with multiple groups
- Functions: geom_boxplot(), stat_boxplot(), stat_summary()
- Rotate a plot: flip and reverse
- Horizontal plot : coord_flip()
- Reverse y axis
- Functions: coord_flip(), scale_x_reverse(), scale_y_reverse()
- Faceting: split a plot into a matrix of panels
- Facet with one variable
- Facet with two variables
- Facet scales
- Facet labels
- facet_wrap
- Functions: facet_grid(), facet_wrap(), label_both(), label_bquote(), label_parsed()
- factoextra - Extract and Visualize the outputs of a multivariate analysis: PCA (Principal Component Analysis), CA (Correspondence Analysis), MCA (Multiple Correspondence Analysis) and clustering analyses.
- easyggplot2: Perform and customize easily a plot with ggplot2: box plot, dot plot, strip chart, violin plot, histogram, density plot, scatter plot, bar plot, line plot, etc, …
- ggplot2 - Easy way to mix multiple graphs on the same page
- ggplot2: Correlation matrix heatmap. Functions: geom_raster() and geom_tile()
- ggfortify: Allow ggplot2 to handle some popular R packages. These include plotting 1) Matrix; 2) Linear Model and Generalized Linear Model; 3) Time Series; 4) PCA/Clustering; 5) Survival Curve; 6) Probability distribution
- GGally: GGally extends ggplot2 for visualizing correlation matrix, scatterplot plot matrix, survival plot and more.
- ggRandomForests: Graphical analysis of random forests with the randomForestSRC and ggplot2 packages.
- ggdendro: Create dendrograms and tree diagrams using ggplot2
- ggmcmc: Tools for Analyzing MCMC Simulations from Bayesian Inference
- ggthemes: Package with additional ggplot2 themes and scales
- Theme used to create journal ready figures easily
绘图菜谱
链接:http://www.cookbook-r.com/Graphs/这个有中文翻译版本,务必直接下单购买,放在书桌旁边随时翻阅。内容:- Bar and line graphs (ggplot2)
- Plotting means and error bars (ggplot2)
- Plotting distributions (ggplot2) - Histograms, density curves, boxplots
- Scatterplots (ggplot2)
- Titles (ggplot2)
- Axes (ggplot2) - Control axis text, labels, and grid lines.
- Legends (ggplot2)
- Lines (ggplot2) - Add lines to a graph.
- Facets (ggplot2) - Slice up data and graph the subsets together in a grid.
- Multiple graphs on one page (ggplot2)
- Colors (ggplot2)
最后一个是 https://stackoverflow.com/
你会发现,你想实现的各种稀奇古怪的绘图需求,只需要你能使用英文描述出来,就是能找到答案的!- 用谷歌搜索来使用ggplot2做可视化(上):https://mp.weixin.qq.com/s/WN4TSMNjH4b6vZgYVjaRvQ
- 用谷歌搜索来使用ggplot2做可视化(下):https://mp.weixin.qq.com/s/_Q16zDZgCr3XoO0r3wqRkw
- 了解常量和变量概念
- 加减乘除等运算(计算器)
- 多种数据类型(数值,字符,逻辑,因子)
- 多种数据结构(向量,矩阵,数组,数据框,列表)
- 文件读取和写出
- 简单统计可视化
- 无限量函数学习
文末友情宣传
强烈建议你推荐我们生信技能树给身边的 博士后以及年轻生物学PI,帮助他们多一点数据认知,让科研更上一个台阶:- 生信爆款入门-全球听(买一得五)(第4期),你的生物信息学入门课
- 数据挖掘第2期(两天变三周,实力加量),医学生/临床医师首选技能提高课
- 生信技能树的2019年终总结 ,你的生物信息学成长宝藏
- 2020学习主旋律,B站74小时免费教学视频为你领路,还等什么,看啊!!!