大家应该是看过了无数R绘图技巧代码,各种R包介绍。我们基本上不写这方面,主要是因为早就过了需要美图引流的阶段,分享自己实践过程的真实代码经验比一味地翻译画图博客和文档好很多。
而且最近看到很多人在朋友圈转发这个: r-graph-gallery ,感觉就这一个网站就可以养活一个公众号了:
网址:http://www.r-graph-gallery.com/
r-garp-gallery收入了大量利用R语言绘制的图形,这些图形包含了很多方面,通过这个网站,我们可以方便直观观察到R语言所能做的一些图形。
Distribution
- Violin
- Density
- Histogram
- Boxplot
- Ridgeline
Correlation
- Scatter
- Heatmap
- Correlogram
- Bubble
- Connected scatter
- Density 2d
Ranking
- Barplot
- Spider / Radar
- Wordcloud
- Parallel
- Lollipop
- Circular Barplot
Part of a whole
- Grouped and Stacked barplot
- Treemap
- Doughnut
- Pie chart
- Dendrogram
- Circular packing
Evolution
- Line plot
- Area
- Stacked area
- Streamchart
- Time Series
Map
- Map
- Choropleth
- Hexbin map
- Cartogram
- Connection
- Bubble map
Flow
- Chord diagram
- Network
- Sankey
- Arc diagram
- Edge bundling
General knowledge
- Ggplot2
- Animation
- Interactivity
- 3D
- Caveats
- Data art
最重要的是每个图都配有示例数据和代码
比如:http://www.r-graph-gallery.com/294-basic-ridgeline-plot.html
出图如下:
配套代码是:
代码语言:javascript复制# library
library(ggridges)
library(ggplot2)
# Diamonds dataset is provided by R natively
#head(diamonds)
# basic example
ggplot(diamonds, aes(x = price, y = cut, fill = cut))
geom_density_ridges()
theme_ridges()
theme(legend.position = "none")
是不是超级简单啊!
还有更多美图,比如小提琴图也是丰富多彩:http://www.r-graph-gallery.com/violin.html