之前最多只做过两类单水平的分面,即两两组合的面板图.如果某类超过两个水平呢? 一类的分面:facet_wrap(~ align) 两类的分面(x轴和y轴):facet_grid(align ~ gender) 如果某类超过两水平,如何实现? 很简单:facet_wrap(~ align + gender) 其他技巧: 自定义图片行列数目排布: facet_wrap(~ gender + align, nrow = 2) 分面中加入总水平 facet_grid(align ~ gender, ma…
Part 3: Top 50 ggplot2 Visualizations - The Master List, 结合进阶1.2内容构建图形 有效的图形是: 不扭曲事实 传递正确的信息 简洁优雅 美观是为了凸显信息 而不要盖过信息 不超载信息 1 相关性图 散点图 最常用 # install.packages("ggplot2") # load package and data options(scipen=999) # turn-off scientific notation lik…
问题描述:给一个5G的大文件,保存的数据为32位的整型,找到所有出现次数超过两次的数字 大数据操作: 解决方法一: 依次遍历文件数据, 开始32二进制清0 每次读取一个数,先和二进制位与,如果为0 则没有,再把数字与二进制数位或.如果为1,则输出这个数 直到读取文件最后一个数字 举例说明: 0000 0000 0000 0000 0000 0000 0000 0000 开始的二进制位 倘若第一个数为2 那么0000 0000 0000 0000 0000 0000 0000 0010  开始位与…
ggplot2在一幅图上画两条曲线 print(data)后的结果是 C BROWN.P MI.P 0 0.9216 0.9282 30 0.9240 0.9282 100 0.9255 0.9282 现想要在一张图中画两条曲线.横轴为C,纵轴分别为BROWN.P和MI.P,如何做? 其实很简单 p1<-ggplot(brown.results, aes(x=C)) + geom_point(aes(y=BROWN.P), ) + geom_line(aes(y=BROWN.P, , color…
Joanna Zhao’s and Jenny Bryan’s R graph catalog is meant to be a complement to the physical book,Creating More Effective Graphs, but it’s a really nice gallery in its own right. The catalog shows a series of different data visualizations, all made wi…
Part 2: Customizing the Look and Feel, 更高级的自定义化,比如说操作图例.注记.多图布局等  # Setup options(scipen=999) library(ggplot2) data("midwest", package = "ggplot2") theme_set(theme_bw()) # midwest <- read.csv("http://goo.gl/G1K41K") # bkup…
摘自  http://f.dataguru.cn/thread-278300-1-1.html library(ggplot2) x=1:10y=rnorm(10)a=data.frame(x= x, y= y) # plot(y~x,data=a) lm_eqn = function(df){m = lm(y ~ x, df);eq <- substitute(italic(y) == a + b %.% italic(x)*","~~italic(r)^2~"=&q…
1 安装 # 获取ggplot2 最容易的就是下载整个tidyverse: install.packages("tidyverse") # 也可以选择只下载ggplot2: install.packages("ggplot2") # 或者下载GitHub上的开发者版本 # install.packages("devtools") devtools::install_github("tidyverse/ggplot2") 2 快…
持续更新~ 散点图 条形图 文氏图 饼图 盒型图 频率直方图 热图 PCA图 3D图 火山图 分面图 分面制作小多组图 地图 练习数据: year count china Ame jap '12 2.800000 1.500000 4.500000 2.500000 '13 2.941956 1.587559 5.342547 2.814862 '14 3.508838 1.648075 5.429438 2.701108 '15 4.011208 1.533966 5.419301 2.660…
p<-ggplot(iris,aes(Petal.Length,Petal.Width,color=Species))+geom_point()cols=c("red","green","blue") scale_colour_manual和scale_fill_manual用法相同更改颜色和legend lablesp + scale_colour_manual(values = cols, breaks = c("4"…