Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/76.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R geom_棒棒糖(包装Ggalt)不起作用_R_Ggalt - Fatal编程技术网

R geom_棒棒糖(包装Ggalt)不起作用

R geom_棒棒糖(包装Ggalt)不起作用,r,ggalt,R,Ggalt,下面是关于如何使用geom_棒棒糖的教程 我尝试运行的代码如下所示: df <- read.csv(text="category,pct Other,0.09 South Asian/South Asian Americans,0.12 Interngenerational/Generational,0.21 S Asian/Asian Americans,0.25 Mu

下面是关于如何使用
geom_棒棒糖
的教程

我尝试运行的代码如下所示:

df <- read.csv(text="category,pct
Other,0.09
               South Asian/South Asian Americans,0.12
               Interngenerational/Generational,0.21
               S Asian/Asian Americans,0.25
               Muslim Observance,0.29
               Africa/Pan Africa/African Americans,0.34
               Gender Equity,0.34
               Disability Advocacy,0.49
               European/European Americans,0.52
               Veteran,0.54
               Pacific Islander/Pacific Islander Americans,0.59
               Non-Traditional Students,0.61
               Religious Equity,0.64
               Caribbean/Caribbean Americans,0.67
               Latino/Latina,0.69
               Middle Eastern Heritages and Traditions,0.73
               Trans-racial Adoptee/Parent,0.76
               LBGTQ/Ally,0.79
               Mixed Race,0.80
               Jewish Heritage/Observance,0.85
               International Students,0.87", stringsAsFactors=FALSE, sep=",", header=TRUE)


library(ggplot2)
library(scales)
library(ggalt)


gg <- ggplot(df, aes(y=reorder(category, pct), x=pct))
gg <- gg + geom_lollipop(point.colour="steelblue", point.size=3, horizontal=TRUE)
gg <- gg + scale_x_continuous(expand=c(0,0), labels=percent,
                              breaks=seq(0, 1, by=0.2), limits=c(0, 1))
gg <- gg + labs(x=NULL, y=NULL, 
                title="SUNY Cortland Multicultural Alumni survey results")
gg <- gg + theme_minimal(base_family="Arial Narrow")
gg <- gg + theme(panel.grid.major.y=element_blank())
gg <- gg + theme(panel.grid.minor=element_blank())
gg <- gg + theme(axis.line.y=element_line(color="#2b2b2b", size=0.15))
gg <- gg + theme(axis.text.y=element_text(margin=margin(r=-5, l=0)))
gg <- gg + theme(plot.margin=unit(rep(30, 4), "pt"))
gg <- gg + theme(plot.title=element_text(face="bold"))
gg
知道为什么这不起作用吗?

(根据评论更新)

适用于我使用
ggalt\u 0.3.0.9000比例\u 0.4.0 ggplot2\u 2.1.0

也许您需要Github/devel版本?尝试重新启动会话/卸载
ggalt
,然后

devtools::install_github("hrbrmstr/ggalt")

然后重新加载包。

适用于我使用
ggalt\u 0.3.0.9000 scales\u 0.4.0 ggplot2\u 2.1.0
(可能您需要Github/devel版本?试试
devtools::install\u Github(“hrbrmstr/ggalt”)
。完全相同的代码(第一个块)适用于我(pkg作者)。也许还可以尝试执行
devtools::install\u Github(“hadley/ggplot2”)
@BenBolker是的,它似乎与devel版本一起工作!非常感谢!
devtools::install_github("hrbrmstr/ggalt")