在哪里可以找到有关ggplot选项的文档? [英] Where can I find documentation on the `..*..` ggplot options?

查看:72
本文介绍了在哪里可以找到有关ggplot选项的文档?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不时使用 .. density .. ,这很棒. ggplot2 书中还有很多示例,以及 .. count .. .浏览 stat_density文档,我了解了 .scaled .. .看到有人在StackOverflow上使用 .. n .. ,我发现了这一点.现在我只是想知道我还缺少什么.

I use ..density.. from time to time, and it's great. There's lots of examples of it in the ggplot2 book, as well as ..count... Looking through the stat_density documentation, I learned about ..scaled... Seeing someone use ..n.. here on StackOverflow, I found out about that. Now I just wonder what else I'm missing.

搜索引擎似乎忽略了诸如"..n .. ggplot2"之类的搜索字符串中的..这些变量是否有一个通用术语?还有更多吗?在哪里可以找到有关它们的文档?

Search engines seem to ignore the .s in search strings like "..n.. ggplot2", even if I escape them. Is there a general term for these variables? Are there more? Where can I find documentation on them?

推荐答案

以下是 ggplot2 帮助文件(或至少可以通过键入?< func>" 来调出的帮助文件,其中< func>" 是指 ggplot2 ).

Here are all of the ..*.. options mentioned in the ggplot2 help files (or at least those help files that can be brought up by typing ?"<func>", where "<func>" refers to one of the functions exported by ggplot2).

library(ggplot2)

## Read all of the ggplot2 help files and convert them to character vectors
ex <- unlist(lapply(ls("package:ggplot2"), function(g) {
    p = utils:::index.search(g, find.package(), TRUE)
    capture.output(tools::Rd2txt(utils:::.getHelpFile(p)))
}))

## Extract all mentions of "..*.." from the character vectors
pat <- "\\.\\.\\w*\\.\\."
m <- gregexpr(pat, ex)    
unique(unlist(regmatches(ex,m)))
# [1] "..density.."  "..count.."    "..level.."    "..scaled.."   "..quantile.."
# [6] "..n.."   

或者,要找出哪些帮助文件记录了哪些 .. * .. ,请运行以下命令:

Or, to find out which help files document which ..*.., run this:

library(ggplot2)

ex <- sapply(ls("package:ggplot2"), function(g) {
    p = utils:::index.search(g, find.package(), TRUE)
    capture.output(tools::Rd2txt(utils:::.getHelpFile(p)))
}, simplify=FALSE, USE.NAMES=TRUE)

res <- lapply(ex, function(X) {
    m <- gregexpr("\\.\\.\\w*\\.\\.", X)    
    unique(unlist(regmatches(X, m)))
})
res[sapply(res, length) > 0]

这篇关于在哪里可以找到有关ggplot选项的文档?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆