{"action":"created","comment":{"url":"https://api.github.com/repos/cosname/cosx.org/pulls/comments/108700903","pull_request_review_id":29746243,"id":108700903,"diff_hunk":"@@ -0,0 +1,353 @@\n+---\n+title: ggimage：ggplot2中愉快地使用图片\n+date: '2017-03-29T21:58:23+00:00'\n+description: \"本文介绍了ggimage包，允许在ggplot2作图时嵌入图片，并支持aes映射，可以把离散型变量映射到不同图片。目前有几个包可以使用图片嵌入做图，但都是针对特定的场景，这里使用ggimage来展示在这些特定领域里的应用，ggimage的设计是通用的，并不被特定场景所限定，文末又介绍了用R图标来画出R、用饼图来画气泡图等实例。 作者简介：余光创，香港大学公共卫生学院，生物信息学博士生。\"\n+author: 余光创\n+categories:\n+  - ggplot2\n+  - ggimage\n+  - 图片\n+  - R\n+slug: ggimage\n+---\n+\n+\n+> 作者简介：余光创，香港大学公共卫生学院，生物信息学博士生。\n+>\n+> 博客：<https://guangchuangyu.github.io>， 公众号：biobabble\n+\n+\n+# 导言\n+\n+本文介绍了`ggimage`包，允许在`ggplot2`作图时嵌入图片，并支持`aes`映射，可以把离散型变量映射到不同图片。目前有几个包可以使用图片嵌入做图，但都是针对特定的场景，这里使用`ggimage`来展示在这些特定领域里的应用，`ggimage`的设计是通用的，并不被特定场景所限定，文末又介绍了用R图标来画出R、用饼图来画气泡图等实例。\n+\n+\n+# 图上嵌图片\n+\n+\n+Base plot可以在做图的时候嵌入图片，使用的是`graphics::rasterImage`：\n+\n+```r\n+imgurl <- \"http://phylopic.org/assets/images/submissions/295cd9f7-eef2-441e-ba7e-40c772ca7611.256.png\"\n+library(EBImage)\n+x <- readImage(imgurl)\n+plot(1, type = \"n\", xlab = \"\", ylab = \"\", xlim = c(0, 8), ylim = c(0, 8))\n+rasterImage(x, 2, 2, 6, 4)\n+```\n+\n+![](https://raw.githubusercontent.com/Lchiffon/ggimage-md-for-COS/master/figures/raster.png)\n+\n+<!--more--> \n+\n+如果我们搜索\"ggplot2 image\"，会找到类似于下面这样的帖子/博文：\n+\n++ [r - Inserting an image to ggplot2 - Stack Overflow](https://stackoverflow.com/questions/9917049/inserting-an-image-to-ggplot2)\n++ [Add a background png image to ggplot2 | R-bloggers](https://www.r-bloggers.com/add-a-background-png-image-to-ggplot2/)\n+\n+也就是说通过程序员秘笈，搜索，我们用ggplot2同样也可以做到。\n+\n+这里我们需要用到`annotation_custom(rasterGrob)`来把图片加到ggplot2图形中，这和base plot是一模一样的。\n+\n+\n+```r\n+library(grid)\n+library(ggplot2)\n+\n+p <- ggplot(d = data.frame(x = c(0, 8), y = c(0, 8)), aes(x, y)) + geom_blank()\n+p + annotation_custom(rasterGrob(x), 2, 6, 2, 4)\n+```\n+\n+\n+\n+如果要使用图片来打点画一个散点图，我们就需要`for`循环，对每一个点进行操作，这显然是low level的操作，而`ggplot2`是一个高抽象的画图系统，我们希望能够使用`ggplot2`的语法。\n+\n+`ggimage`就是来实现这样一个功能，它只是一个简单的包，允许我们在ggplot2中把离散性变量映射到不同的图片来画图。\n+\n+\n+![](https://raw.githubusercontent.com/Lchiffon/ggimage-md-for-COS/master/figures/Screenshot1.png)\n+\n+\n+实现这个功能的想法已经酝酿很久了，在`ggtree`的开发中，我实现了`phylopic`函数来使用Phylopic数据库的图片注释进化树，也实现了`subview`函数在图上嵌入小图。用图片来注释进化树在进化分析上还是很常见的，特别是在一些分类学的研究中，需要把一些分类学特征在进化树上展示出来，而像我们做病毒，也经常会把一些图片放在进化树上来展示病毒的宿主信息。\n+\n+`ggtree`和可视化有关的函数分两类，一类是加注释的图层，另一类是可视化操作树（比如像旋转、合并分支）。操作树的都是普通函数，而加注释的都是`geom`图层，除了`subview`和`phylopic`，这种所谓逼死处女座的存在，我早就想改成了`geom_subview`和`geom_phylopic`了（已实现），这也是为什么我要写`ggimage`的原因了。\n+\n+# 安装\n+\n+`ggimage`依赖于`EBImage`来读图片，这是个Bioconductor包，所以我们需要额外的动作来安装它。\n+\n+## 方法1：通过biocLite\n+\n+```r\n+source(\"https://www.bioconductor.org/biocLite.R\")\n+biocLite(\"ggimage\")\n+```\n+\n+## 方法2：不通过biocLite\n+\n+```r\n+setRepositories(ind = 1:2)\n+install.packages(\"ggimage\")\n+```\n+\n+方法1是按照Bioconductor的方法，或者你也可以用`setRepositories`把Bioconductor软件仓库加进来，这样`install.packages`也可以搜索到它的包。\n+\n+\n+\n+# 实例分析\n+\n+据我所知目前支持使用图片的R包有`CatterPlots`, `rphylopic`, `emoGG`,\n+`ggflags`这几个，都是为特定的目的而实现的，都有其特定的应用场景，而`ggimage`是的\n+`geom_image`是通用的，通过对它进行简单的包装，同样可以实现这些特殊场景的应用图层。\n+\n+__`CatterPlots`__这个包只可以应用于base plot中，通过预设的几个猫图（R对象，随包载入）来画散点图。最近[RevolutionAnalytics 有博文](http://blog.revolutionanalytics.com/2017/02/catterplots-plots-with-cats.html)介绍。`ggplot2`没有相应画猫的包。我们可以使用`ggimage`来画，而且不用限制于`CatterPlots`预设的几个图形。\n+\n+\n+```r\n+library(ggplot2)\n+library(ggimage)\n+\n+mytheme <- theme_minimal() +\n+    theme(axis.title = element_blank())\n+theme_set(mytheme)\n+\n+x <- seq(-2*pi, 2*pi, length.out = 30)\n+d <- data.frame(x = x, y = sin(x))\n+\n+img <- \"http://www.belleamibengals.com/bengal_cat_2.png\"\n+ggplot(d, aes(x, y)) + geom_image(image = img, size = .1)\n+```\n+\n+![](https://raw.githubusercontent.com/Lchiffon/ggimage-md-for-COS/master/figures/ggimage_CatterPlots.png)\n+\n+`CatterPlots`实现的方式就是上面谈到的`rasterImage`内部使用了循环。__`rphylopic`__同时支持base plot和`ggplot2`，也是一样的实现方式，不过`rphylopic`内部没有使用循环，一次只能加一个图，它使用的图来自于[phylopic](http://phylopic.org/)数据库。\n+\n+\n+我们用`ggimage`同样可以使用`phylopic`图片：\n+\n+```r\n+ggplot(d, aes(x, y)) + geom_phylopic(image = \"500bd7c6-71c1-4b86-8e54-55f72ad1beca\", size = .1)\n+```\n+\n+![](https://raw.githubusercontent.com/Lchiffon/ggimage-md-for-COS/master/figures/ggimage_rphylopic.png)\n+\n+> 图中是`翼足目`动物。\n+\n+\n+__`emoGG`__是专门来画`emoji`的，如果要画`emoji`的话，我推荐我写的`emojifont`包，在轩哥的[`showtext`基础](https://cos.name/2014/01/showtext-interesting-fonts-and-graphs/)上，把`emoji`当做普通字体一样操作，更方便。\n+\n+`emoGG`这个包提供了`geom_emoji`图层，虽然一次可以画出散点，但因为不支持`aes`映射，而`ggimage`所提供的`geom_emoji`则支持映射，下面的例子中我们做了一个简单的回归分析，如果残差<0.5用笑脸表示，`>0.5`则用哭脸来表示。\n+\n+```r\n+set.seed(123)\n+iris2 <- iris[sample(1:nrow(iris), 30),]\n+model <- lm(Petal.Length ~ Sepal.Length, data=iris2)\n+iris2$fitted <- predict(model)\n+\n+p <- ggplot(iris2, aes(x = Sepal.Length, y = Petal.Length)) +\n+  geom_linerange(aes(ymin = fitted, ymax = Petal.Length),\n+                 colour = \"purple\") +\n+  geom_abline(intercept = model$coefficients[1],\n+              slope = model$coefficients[2])\n+\n+p + ggimage::geom_emoji(aes(image = ifelse(abs(Petal.Length-fitted) > 0.5, '1f622', '1f600')))\n+```\n+\n+![](https://raw.githubusercontent.com/Lchiffon/ggimage-md-for-COS/master/figures/emoji_residual2.png)\n+\n+如果要用`emoGG`来做的话，则需要自己切数据分两次来进行：\n+\n+```r\n+p + emoGG::geom_emoji(data=subset(iris2, (Petal.Length-fitted)<0.5), emoji=\"1f600\") +\n+    emoGG::geom_emoji(data=subset(iris2, (Petal.Length-fitted)>0.5), emoji=\"1f622\")\n+```\n+\n+这里我们只分两类(残差是否大于0.5)，所以需要加两次，试想我们的分类变量有多种可能的取值，则我们需要分多次切数据加图层，`CatterPlots`、`rphylopic`和`emoGG`都有这个问题，这也是`aes`映射之于`ggplot2`的重要和强大之处，它让我们可以在更高的抽像水平思考，\n+\n+__`ggflags`__是支持`aes`映射的，只不过它只能用来画国旗而已。同样`ggimage`也提供\n+了相应的`geom_flag`来使用国旗用于做图。\n+\n+\n+```r\n+library(rvest)\n+library(dplyr)\n+\n+url <- \"http://www.nbcolympics.com/medals\"\n+\n+medals <- read_html(url) %>%\n+    html_nodes(\"table\") %>%\n+    html_table() %>% .[[1]]\n+\n+library(countrycode)\n+library(tidyr)\n+\n+medals <- medals %>%\n+    mutate(code = countrycode(Country, \"country.name\", \"iso2c\")) %>%\n+    gather(medal, count, Gold:Bronze) %>%\n+    filter(Total >= 10)\n+\n+head(medals)\n+```\n+\n+|Country       | Total|code |medal | count|\n+|:-------------|-----:|:----|:-----|-----:|\n+|Russia        |    33|RU   |Gold  |    13|\n+|United States |    28|US   |Gold  |     9|\n+|Norway        |    26|NO   |Gold  |    11|\n+|Canada        |    25|CA   |Gold  |    10|\n+|Netherlands   |    24|NL   |Gold  |     8|\n+|Germany       |    19|DE   |Gold  |     8|\n+\n+\n+首先我们从网站上爬回来2016年各个国家的奥林匹克奖牌数，画出柱状图，并在`xlab`国家名边上用`ggimage`画上国旗：\n+\n+```r\n+p <- ggplot(medals, aes(Country, count)) + geom_col(aes(fill=medal), width=.8)\n+\n+p + geom_flag(y = -2, aes(image = code)) +\n+    coord_flip() + expand_limits(y=-2)  +\n+    scale_fill_manual(values = c(\"Gold\" = \"gold\", \"Bronze\" = \"#cd7f32\",\"Silver\" = \"#C0C0C0\"))\n+```\n+\n+![](https://raw.githubusercontent.com/Lchiffon/ggimage-md-for-COS/master/figures/olympics_2016.png)\n+\n+## `ggimage`\n+\n+前面我们介绍了`ggimage`在一些场景的应用实例，虽然有专门的包针对这些应用场景，但`ggimage`在这些领域中的表现要比大多数的包要好（支持aes映射）。但`ggimage`的使用并不限于这些(`geom_phylopic`，`geom_emoji`和`geom_flag`只是通用图层`geom_image`的简单封装)，这里将展示一些有趣的例子。\n+\n+#### 用R图标来画R形状\n+\n+```r\n+x <- c(2,2,2,2,2,3,3,3.5,3.5,4)\n+y <- c(2,3,4,5,6,4,6,3,5,2)\n+d <- data.frame(x=x, y=y)\n+\n+img <- system.file(\"img\", \"Rlogo.png\", package=\"png\")\n+ggplot(d, aes(x, y)) + geom_image(image=img, size=.1) +\n+  xlim(0,6) + ylim(0,7)\n+```\n+\n+![](https://raw.githubusercontent.com/Lchiffon/ggimage-md-for-COS/master/figures/R.png)\n+\n+#### 嵌套式绘图\n+\n+这里我要展示的是非常有名的bubble plot，但bubble不是圆圈，而是使用\n+`ggplot2`画的饼图，我先把饼图保存起来，再用`ggimage`拿来画，饼图的大小\n+与人口总数正相关。这个例子可以应用到很多场景中去，比如一个时间序列的曲线，你要用统计图在某些时间点上展示相关的信息，比如你要在地图上加某些地方的相关统计信息（如果要在地图上画饼图，可以使用我写的[scatterpie](https://cran.r-project.org/package=scatterpie)包）。\n+\n+```r\n+crime <- read.csv(\"http://datasets.flowingdata.com/crimeRatesByState2005.tsv\",\n+                  header=TRUE, sep=\"\\t\", stringsAsFactors=F)\n+```\n+\n+|state      | murder| Forcible_rate| Robbery| aggravated_assult| burglary| larceny_theft| motor_vehicle_theft| population|\n+|:----------|------:|-------------:|-------:|-----------------:|--------:|-------------:|-------------------:|----------:|\n+|Alabama    |    8.2|          34.3|   141.4|             247.8|    953.8|        2650.0|               288.3|    4627851|\n+|Alaska     |    4.8|          81.1|    80.9|             465.1|    622.5|        2599.1|               391.0|     686293|\n+|Arizona    |    7.5|          33.8|   144.4|             327.4|    948.4|        2965.2|               924.4|    6500180|\n+|Arkansas   |    6.7|          42.9|    91.1|             386.8|   1084.6|        2711.2|               262.1|    2855390|\n+|California |    6.9|          26.0|   176.1|             317.3|    693.3|        1916.5|               712.8|   36756666|\n+|Colorado   |    3.7|          43.4|    84.6|             264.7|    744.8|        2735.2|               559.5|    4861515|\n+\n+\n+```r\n+library(gtable)\n+\n+plot_pie <- function(i) {\n+    df <- gather(crime[i,], type, value, murder:motor_vehicle_theft)\n+    ggplot(df, aes(x=1, value,fill=type)) +\n+        geom_col() + coord_polar(theta = 'y') +\n+        ggtitle(crime[i, \"state\"]) +\n+        theme_void() + theme_transparent() +\n+        theme(legend.position = \"none\",\n+              plot.title = element_text(size=rel(6), hjust=0.5))\n+}\n+\n+pies <- sapply(1:nrow(crime), function(i) {\n+    outfile <- paste0(\"crime_\", i, \".png\")\n+    plot_pie(i) + ggsave(outfile, bg=\"transparent\")\n+    outfile\n+})\n+\n+radius <- sqrt(crime$population / pi)\n+crime$radius <- 0.2*radius/max(radius)\n+crime$pie <- pies\n+\n+leg1 <- gtable_filter(\n+    ggplot_gtable(\n+        ggplot_build(plot_pie(1) + theme(legend.position=\"right\"))\n+    ), \"guide-box\")\n+\n+ggplot(crime, aes(murder, Robbery)) +\n+  geom_image(aes(image=pie, size=I(radius))) +\n+  geom_subview(leg1, x=8.8, y=50)\n+```\n+\n+![](https://raw.githubusercontent.com/Lchiffon/ggimage-md-for-COS/master/figures/us_crime.png)\n+\n+我们还可以每次只画一个州的数据，制作成动图。\n+\n+```r\n+plot_crime <- function(i) {\n+    o <- paste0(i, \".png\")\n+    ggplot(crime, aes(murder, Robbery)) + geom_blank() +\n+        geom_image(data=crime[i,], aes(image=pie, size=I(radius))) +\n+        geom_subview(p, leg1, x=8.8, y=50) + ggsave(o)\n+    o\n+}\n+\n+library(magick)\n+library(purrr)\n+order(crime$murder, decreasing=F) %>%\n+    map(plot_crime) %>%\n+    map(image_read) %>%\n+    image_join() %>%\n+    image_animate(fps=2) %>%\n+    image_write(\"crime.gif\")\n+```\n+\n+![](https://raw.githubusercontent.com/Lchiffon/ggimage-md-for-COS/master/figures/us_crime.gif)\n+\n+`geom_subview`可以图上嵌图，并不需要保存为图片，但对于`ggplot2`来讲，保存图片也是有好处的，因为`ggplot2`画图，点线是在数据空间上，随着我们保存图片的大小是按比例缩小或放大的，但文字是在像素空间上，和画图空间并不相关。所以当我们嵌图时缩小了画图窗口之后，字体会显得格外大，微调起来也比较繁琐，这时候保存为合适尺寸的图片，再用`geom_image`来加上去，显然就轻松得多。\n+\n+\n+#### 其它来自R社区的例子\n+\n+SAS博客对`M&M`巧克力的[颜色分布做了分析](http://blogs.sas.com/content/iml/2017/02/20/proportion-of-colors-mandms.html)，通过simulation估计不同颜色的置信区间。这个[分析被翻译成R](http://rpubs.com/hrbrmstr/mms)，并产生下图：","path":"content/post/2017-03-29-ggimage.md","position":315,"original_position":315,"commit_id":"c75dc603b4b9bcaafc630010b267ce05255bdedb","original_commit_id":"c75dc603b4b9bcaafc630010b267ce05255bdedb","user":{"login":"yihui","id":163582,"avatar_url":"https://avatars1.githubusercontent.com/u/163582?v=3","gravatar_id":"","url":"https://api.github.com/users/yihui","html_url":"https://github.com/yihui","followers_url":"https://api.github.com/users/yihui/followers","following_url":"https://api.github.com/users/yihui/following{/other_user}","gists_url":"https://api.github.com/users/yihui/gists{/gist_id}","starred_url":"https://api.github.com/users/yihui/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yihui/subscriptions","organizations_url":"https://api.github.com/users/yihui/orgs","repos_url":"https://api.github.com/users/yihui/repos","events_url":"https://api.github.com/users/yihui/events{/privacy}","received_events_url":"https://api.github.com/users/yihui/received_events","type":"User","site_admin":false},"body":"simulation -> 模拟\r\n\r\n这个英文单词不算专业词汇，没必要使用中英混杂术。","created_at":"2017-03-29T15:03:57Z","updated_at":"2017-03-29T15:07:05Z","html_url":"https://github.com/cosname/cosx.org/pull/198#discussion_r108700903","pull_request_url":"https://api.github.com/repos/cosname/cosx.org/pulls/198","_links":{"self":{"href":"https://api.github.com/repos/cosname/cosx.org/pulls/comments/108700903"},"html":{"href":"https://github.com/cosname/cosx.org/pull/198#discussion_r108700903"},"pull_request":{"href":"https://api.github.com/repos/cosname/cosx.org/pulls/198"}}},"pull_request":{"url":"https://api.github.com/repos/cosname/cosx.org/pulls/198","id":113142560,"html_url":"https://github.com/cosname/cosx.org/pull/198","diff_url":"https://github.com/cosname/cosx.org/pull/198.diff","patch_url":"https://github.com/cosname/cosx.org/pull/198.patch","issue_url":"https://api.github.com/repos/cosname/cosx.org/issues/198","number":198,"state":"open","locked":false,"title":"ggimage post","user":{"login":"GuangchuangYu","id":626539,"avatar_url":"https://avatars2.githubusercontent.com/u/626539?v=3","gravatar_id":"","url":"https://api.github.com/users/GuangchuangYu","html_url":"https://github.com/GuangchuangYu","followers_url":"https://api.github.com/users/GuangchuangYu/followers","following_url":"https://api.github.com/users/GuangchuangYu/following{/other_user}","gists_url":"https://api.github.com/users/GuangchuangYu/gists{/gist_id}","starred_url":"https://api.github.com/users/GuangchuangYu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GuangchuangYu/subscriptions","organizations_url":"https://api.github.com/users/GuangchuangYu/orgs","repos_url":"https://api.github.com/users/GuangchuangYu/repos","events_url":"https://api.github.com/users/GuangchuangYu/events{/privacy}","received_events_url":"https://api.github.com/users/GuangchuangYu/received_events","type":"User","site_admin":false},"body":"PR for <https://github.com/cosname/cosx.org/issues/42>.\r\n","created_at":"2017-03-29T08:23:10Z","updated_at":"2017-03-29T15:07:05Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8727032da276774e38fcb1a2f10602dab2e98901","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/cosname/cosx.org/pulls/198/commits","review_comments_url":"https://api.github.com/repos/cosname/cosx.org/pulls/198/comments","review_comment_url":"https://api.github.com/repos/cosname/cosx.org/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cosname/cosx.org/issues/198/comments","statuses_url":"https://api.github.com/repos/cosname/cosx.org/statuses/c75dc603b4b9bcaafc630010b267ce05255bdedb","head":{"label":"GuangchuangYu:master","ref":"master","sha":"c75dc603b4b9bcaafc630010b267ce05255bdedb","user":{"login":"GuangchuangYu","id":626539,"avatar_url":"https://avatars2.githubusercontent.com/u/626539?v=3","gravatar_id":"","url":"https://api.github.com/users/GuangchuangYu","html_url":"https://github.com/GuangchuangYu","followers_url":"https://api.github.com/users/GuangchuangYu/followers","following_url":"https://api.github.com/users/GuangchuangYu/following{/other_user}","gists_url":"https://api.github.com/users/GuangchuangYu/gists{/gist_id}","starred_url":"https://api.github.com/users/GuangchuangYu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GuangchuangYu/subscriptions","organizations_url":"https://api.github.com/users/GuangchuangYu/orgs","repos_url":"https://api.github.com/users/GuangchuangYu/repos","events_url":"https://api.github.com/users/GuangchuangYu/events{/privacy}","received_events_url":"https://api.github.com/users/GuangchuangYu/received_events","type":"User","site_admin":false},"repo":{"id":86556246,"name":"cosx.org","full_name":"GuangchuangYu/cosx.org","owner":{"login":"GuangchuangYu","id":626539,"avatar_url":"https://avatars2.githubusercontent.com/u/626539?v=3","gravatar_id":"","url":"https://api.github.com/users/GuangchuangYu","html_url":"https://github.com/GuangchuangYu","followers_url":"https://api.github.com/users/GuangchuangYu/followers","following_url":"https://api.github.com/users/GuangchuangYu/following{/other_user}","gists_url":"https://api.github.com/users/GuangchuangYu/gists{/gist_id}","starred_url":"https://api.github.com/users/GuangchuangYu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GuangchuangYu/subscriptions","organizations_url":"https://api.github.com/users/GuangchuangYu/orgs","repos_url":"https://api.github.com/users/GuangchuangYu/repos","events_url":"https://api.github.com/users/GuangchuangYu/events{/privacy}","received_events_url":"https://api.github.com/users/GuangchuangYu/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/GuangchuangYu/cosx.org","description":"统计之都主站（测试！）","fork":true,"url":"https://api.github.com/repos/GuangchuangYu/cosx.org","forks_url":"https://api.github.com/repos/GuangchuangYu/cosx.org/forks","keys_url":"https://api.github.com/repos/GuangchuangYu/cosx.org/keys{/key_id}","collaborators_url":"https://api.github.com/repos/GuangchuangYu/cosx.org/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/GuangchuangYu/cosx.org/teams","hooks_url":"https://api.github.com/repos/GuangchuangYu/cosx.org/hooks","issue_events_url":"https://api.github.com/repos/GuangchuangYu/cosx.org/issues/events{/number}","events_url":"https://api.github.com/repos/GuangchuangYu/cosx.org/events","assignees_url":"https://api.github.com/repos/GuangchuangYu/cosx.org/assignees{/user}","branches_url":"https://api.github.com/repos/GuangchuangYu/cosx.org/branches{/branch}","tags_url":"https://api.github.com/repos/GuangchuangYu/cosx.org/tags","blobs_url":"https://api.github.com/repos/GuangchuangYu/cosx.org/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/GuangchuangYu/cosx.org/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/GuangchuangYu/cosx.org/git/refs{/sha}","trees_url":"https://api.github.com/repos/GuangchuangYu/cosx.org/git/trees{/sha}","statuses_url":"https://api.github.com/repos/GuangchuangYu/cosx.org/statuses/{sha}","languages_url":"https://api.github.com/repos/GuangchuangYu/cosx.org/languages","stargazers_url":"https://api.github.com/repos/GuangchuangYu/cosx.org/stargazers","contributors_url":"https://api.github.com/repos/GuangchuangYu/cosx.org/contributors","subscribers_url":"https://api.github.com/repos/GuangchuangYu/cosx.org/subscribers","subscription_url":"https://api.github.com/repos/GuangchuangYu/cosx.org/subscription","commits_url":"https://api.github.com/repos/GuangchuangYu/cosx.org/commits{/sha}","git_commits_url":"https://api.github.com/repos/GuangchuangYu/cosx.org/git/commits{/sha}","comments_url":"https://api.github.com/repos/GuangchuangYu/cosx.org/comments{/number}","issue_comment_url":"https://api.github.com/repos/GuangchuangYu/cosx.org/issues/comments{/number}","contents_url":"https://api.github.com/repos/GuangchuangYu/cosx.org/contents/{+path}","compare_url":"https://api.github.com/repos/GuangchuangYu/cosx.org/compare/{base}...{head}","merges_url":"https://api.github.com/repos/GuangchuangYu/cosx.org/merges","archive_url":"https://api.github.com/repos/GuangchuangYu/cosx.org/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/GuangchuangYu/cosx.org/downloads","issues_url":"https://api.github.com/repos/GuangchuangYu/cosx.org/issues{/number}","pulls_url":"https://api.github.com/repos/GuangchuangYu/cosx.org/pulls{/number}","milestones_url":"https://api.github.com/repos/GuangchuangYu/cosx.org/milestones{/number}","notifications_url":"https://api.github.com/repos/GuangchuangYu/cosx.org/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/GuangchuangYu/cosx.org/labels{/name}","releases_url":"https://api.github.com/repos/GuangchuangYu/cosx.org/releases{/id}","deployments_url":"https://api.github.com/repos/GuangchuangYu/cosx.org/deployments","created_at":"2017-03-29T08:19:27Z","updated_at":"2017-03-29T08:19:30Z","pushed_at":"2017-03-29T11:03:02Z","git_url":"git://github.com/GuangchuangYu/cosx.org.git","ssh_url":"git@github.com:GuangchuangYu/cosx.org.git","clone_url":"https://github.com/GuangchuangYu/cosx.org.git","svn_url":"https://github.com/GuangchuangYu/cosx.org","homepage":null,"size":3459,"stargazers_count":0,"watchers_count":0,"language":"CSS","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"cosname:master","ref":"master","sha":"720ec9be47ed5c8cc6d5964818f8b9860ad30418","user":{"login":"cosname","id":529133,"avatar_url":"https://avatars3.githubusercontent.com/u/529133?v=3","gravatar_id":"","url":"https://api.github.com/users/cosname","html_url":"https://github.com/cosname","followers_url":"https://api.github.com/users/cosname/followers","following_url":"https://api.github.com/users/cosname/following{/other_user}","gists_url":"https://api.github.com/users/cosname/gists{/gist_id}","starred_url":"https://api.github.com/users/cosname/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cosname/subscriptions","organizations_url":"https://api.github.com/users/cosname/orgs","repos_url":"https://api.github.com/users/cosname/repos","events_url":"https://api.github.com/users/cosname/events{/privacy}","received_events_url":"https://api.github.com/users/cosname/received_events","type":"Organization","site_admin":false},"repo":{"id":85083667,"name":"cosx.org","full_name":"cosname/cosx.org","owner":{"login":"cosname","id":529133,"avatar_url":"https://avatars3.githubusercontent.com/u/529133?v=3","gravatar_id":"","url":"https://api.github.com/users/cosname","html_url":"https://github.com/cosname","followers_url":"https://api.github.com/users/cosname/followers","following_url":"https://api.github.com/users/cosname/following{/other_user}","gists_url":"https://api.github.com/users/cosname/gists{/gist_id}","starred_url":"https://api.github.com/users/cosname/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cosname/subscriptions","organizations_url":"https://api.github.com/users/cosname/orgs","repos_url":"https://api.github.com/users/cosname/repos","events_url":"https://api.github.com/users/cosname/events{/privacy}","received_events_url":"https://api.github.com/users/cosname/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cosname/cosx.org","description":"统计之都主站（测试！）","fork":false,"url":"https://api.github.com/repos/cosname/cosx.org","forks_url":"https://api.github.com/repos/cosname/cosx.org/forks","keys_url":"https://api.github.com/repos/cosname/cosx.org/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cosname/cosx.org/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cosname/cosx.org/teams","hooks_url":"https://api.github.com/repos/cosname/cosx.org/hooks","issue_events_url":"https://api.github.com/repos/cosname/cosx.org/issues/events{/number}","events_url":"https://api.github.com/repos/cosname/cosx.org/events","assignees_url":"https://api.github.com/repos/cosname/cosx.org/assignees{/user}","branches_url":"https://api.github.com/repos/cosname/cosx.org/branches{/branch}","tags_url":"https://api.github.com/repos/cosname/cosx.org/tags","blobs_url":"https://api.github.com/repos/cosname/cosx.org/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cosname/cosx.org/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cosname/cosx.org/git/refs{/sha}","trees_url":"https://api.github.com/repos/cosname/cosx.org/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cosname/cosx.org/statuses/{sha}","languages_url":"https://api.github.com/repos/cosname/cosx.org/languages","stargazers_url":"https://api.github.com/repos/cosname/cosx.org/stargazers","contributors_url":"https://api.github.com/repos/cosname/cosx.org/contributors","subscribers_url":"https://api.github.com/repos/cosname/cosx.org/subscribers","subscription_url":"https://api.github.com/repos/cosname/cosx.org/subscription","commits_url":"https://api.github.com/repos/cosname/cosx.org/commits{/sha}","git_commits_url":"https://api.github.com/repos/cosname/cosx.org/git/commits{/sha}","comments_url":"https://api.github.com/repos/cosname/cosx.org/comments{/number}","issue_comment_url":"https://api.github.com/repos/cosname/cosx.org/issues/comments{/number}","contents_url":"https://api.github.com/repos/cosname/cosx.org/contents/{+path}","compare_url":"https://api.github.com/repos/cosname/cosx.org/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cosname/cosx.org/merges","archive_url":"https://api.github.com/repos/cosname/cosx.org/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cosname/cosx.org/downloads","issues_url":"https://api.github.com/repos/cosname/cosx.org/issues{/number}","pulls_url":"https://api.github.com/repos/cosname/cosx.org/pulls{/number}","milestones_url":"https://api.github.com/repos/cosname/cosx.org/milestones{/number}","notifications_url":"https://api.github.com/repos/cosname/cosx.org/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cosname/cosx.org/labels{/name}","releases_url":"https://api.github.com/repos/cosname/cosx.org/releases{/id}","deployments_url":"https://api.github.com/repos/cosname/cosx.org/deployments","created_at":"2017-03-15T14:41:00Z","updated_at":"2017-03-26T09:30:34Z","pushed_at":"2017-03-29T15:01:47Z","git_url":"git://github.com/cosname/cosx.org.git","ssh_url":"git@github.com:cosname/cosx.org.git","clone_url":"https://github.com/cosname/cosx.org.git","svn_url":"https://github.com/cosname/cosx.org","homepage":null,"size":3572,"stargazers_count":10,"watchers_count":10,"language":"CSS","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":23,"mirror_url":null,"open_issues_count":26,"forks":23,"open_issues":26,"watchers":10,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/cosname/cosx.org/pulls/198"},"html":{"href":"https://github.com/cosname/cosx.org/pull/198"},"issue":{"href":"https://api.github.com/repos/cosname/cosx.org/issues/198"},"comments":{"href":"https://api.github.com/repos/cosname/cosx.org/issues/198/comments"},"review_comments":{"href":"https://api.github.com/repos/cosname/cosx.org/pulls/198/comments"},"review_comment":{"href":"https://api.github.com/repos/cosname/cosx.org/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cosname/cosx.org/pulls/198/commits"},"statuses":{"href":"https://api.github.com/repos/cosname/cosx.org/statuses/c75dc603b4b9bcaafc630010b267ce05255bdedb"}}}}
{"actor":{"display_login":"yihui"}}