仅供参考:我对ggplot2和ggmap相当新,所以我为这些草率的代码道歉,但这是我能够绘制各组点的唯一方法,每组都有自己的颜色.我的操作系统也是ubuntu.
我正在尝试将一个图例添加到ggmap对象中,特别是一个带有连续渐变颜色转换的图例.有什么建议?我在ggmap中尝试过legend属性,但它似乎没有用.以下是我到目前为止的情况.
syd = get_map(location = center, zoom = zoom, maptype = type,color = "bw")
(SYDmap = ggmap(syd, extent = "panel",legend="right")+ annotate('point',x=lng[[1]],xend=max(lng[[1]]),y=lat[[1]],yend=max(lat[[1]]),colour=colorval[1],cex=cexval,pch=pchval))
for(i in 2:(topnum - 1))
SYDmap<- SYDmap + annotate('point',x=lng[[i]],xend=max(lng[[i]]),y=lat[[i]],yend=max(lat[[i]]),colour=colorval[i],cex=cexval,pch=pchval)
i=topnum; (SYDmap <- SYDmap + annotate('point',x=lng[[i]],xend=max(lng[[i]]),y=lat[[i]],yend=max(lat[[i]]),colour=colorval[i],cex=cexval,pch=pchval)) + guides(fill = "colourbar")
Run Code Online (Sandbox Code Playgroud) 我注意到boxplot的中位数(使用受限制的ylim参数构建)可能与中位数() - 函数或没有调整y轴的boxplot获得的中位数不同.
是否意味着箱图仅用于计算位于y轴定义区间内的值?如果是这样,我怎么能得到正确的箱形图(基于所有值),但是在y.axis的特定间隔上绘制它?
非常感谢你.
我想使用facet_wrap生成一个绘图,该绘图对于每个包裹的行具有不同的y比例.换句话说,在同一行上使用固定比例,不同行上的自由比例,具有固定的x比例.自由秤不能完全满足我的要求,也不能提供facet_grid.如果可能的话,我想避免创建两个单独的图,然后将它们粘贴在一起.我正在寻找类似下图的结果,但第一行的最大刻度为300,第二行的最大刻度为50.谢谢你的帮助!
这是我的代码:
library(ggplot2)
library(reshape)
# set up data frame
dat <- data.frame(jack = c(150,160,170),
surgeon = c(155,265,175),
snapper = c(10,15,12),
grouper = c(5,12,50))
dat$island<-c("Oahu","Hawaii","Maui")
df<-melt(dat)
# plot
ggplot(df, aes(fill=variable, y=value, x=island)) +
geom_bar(width = 0.85, position= position_dodge(width=0.5),stat="identity", colour="black") +
facet_wrap(~variable, scales = "free_y",ncol=2) +
theme_bw() +
theme(strip.text = element_text(size=15, face="bold"))+
theme(legend.position="none")+
theme(panel.grid.major = element_line(colour = "white", size = 0.2))+
theme(panel.grid.minor = element_line(colour = "white", size = 0.5))+
theme(axis.text.x = element_text(angle = 90, hjust =1, vjust =0.5, size=18))+
labs(y = expression(paste("Yearly …Run Code Online (Sandbox Code Playgroud) 我试图用directlabels如图所示将标签应用于套索情节在这里.我可以在页面上放置标签,但无法更改大小.在列表中传递其他参数允许我更改其他元素,但不能更改文本大小.
require(ggplot2)
require(directlabels)
dat_test <- data.frame(x=1:10, value=c(sin(1:10), cos(1:10), tan(1:10)), fun=rep(c('sin', 'cos', 'tan'), each=10))
p <- ggplot(dat_test, aes(x=x, y=value, group=fun, colour=fun)) + geom_line()
direct.label(p, 'last.qp') # adds labels
direct.label(p, list('last.qp', size=2)) # does not work, same as above
direct.label(p, list('last.qp', rot=30)) # correct rotates text
Run Code Online (Sandbox Code Playgroud)
是否可以更改直接标签的文字大小?
我正在尝试按照http://blogs.digium.com/2012/11/14/how-to-install-asterisk-11-on-ubuntu-12-4-lts/在Ubuntu 14.04中安装Asterisk 11 .
我收到以下错误: -
READ THIS OR YOUR BUILD WILL FAIL format_mp3.o
format_mp3.c:39:24: fatal error: mp3/mpg123.h: No such file or directory
compilation terminated.
make[2]: *** [format_mp3.o] Error 1
make[1]: *** [addons] Error 2
Run Code Online (Sandbox Code Playgroud) 我创建了金字塔,如图,我想为图的每一面添加标签(类似于构面标签).
我的数据:
dt <- data.frame(Answer = factor(x = rep(x = c(1:3), times = 2),
labels = c("Yes", "No", "Maybe")),
Gender = factor(x = rep(x = c(1:2), each = 3),
labels = c("Female", "Male")),
Prc = c(74.4, 25.0, 0.6, 61.3, 35.5, 3.2),
label = c("74.4%", "25.0%", "0.6%", "61.3%", "35.5%", "3.2%"))
Run Code Online (Sandbox Code Playgroud)
我的情节:

我的剧情生成代码:
xmi <- -70
xma <- 80
library(ggplot2)
ggplot(data = dt, aes(x = Answer, fill = Gender)) +
geom_bar(stat = "identity", subset = .(Gender == "Female"), aes(y = Prc)) + …Run Code Online (Sandbox Code Playgroud) 假设存在一个数组A,其元素是struct Element,我被告知struct Element没有填充.
如果给出指向A中第一个和最后一个元素的指针,我可以根据指针的地址和Element占用的内存量来确定A中的元素数量吗?或者内存中数组的结构不能像那样工作.
我的想法是,如果我给出的指针是Element*start和Element*完成......
number of elements = (finish - start) / sizeof(Element)
Run Code Online (Sandbox Code Playgroud)
这是逻辑思维吗?
M.5 M5.9 M10.14 M14.17 F.5 F5.9 F10.14 F14.17
Alabama 154902 158765 163731 97673 146906 154067 157592 91339
Alaska 27593 27033 26425 15899 26341 25172 24487 14315
Arizona 223705 236024 230633 138579 214067 218351 227456 130770
Arkansas 99007 105750 103149 59618 92649 99763 94845 56848
California 1296287 1296812 1306123 825862 1240523 1239678 1245997 788024
Colorado 172562 187549 168057 100405 164433 172087 170502 95712
Run Code Online (Sandbox Code Playgroud)
我正在使用包从美国社区调查中汇编数据acs。这是数据框的头部,我有关于每个州 5、5-9、10-14 岁以下的男性和女性的数量。数据框名称是 N0018_12_4。我想找出每个州 18 岁以下儿童的总人口。当我像这样尝试 rowsum 时,我收到一条错误消息,指出“缺少参数“组”,没有默认值”。我尝试阅读 R 上的帮助页面并搜索有关如何在 cran/ 其他地方使用参数“组”的示例,但我仍然不明白我应该用该参数做什么。
任何帮助将不胜感激!:)
我希望有人能够更深入地了解GridBagLayout.
我已经阅读了Oracle文档,但我对此并不了解.
如果有人根据他使用GridBagLayout的个人经验写出类似"文档"的内容,我将非常感激.
谢谢!!!
我已经使用了R一段时间了,但在使用时我仍然不知道我在做什么facet_wrap().考虑一下,为了exacmle:
ggplot(df, aes(x, y)) +
geom_bar(stat = "identity") +
facet_wrap(~ z)
Run Code Online (Sandbox Code Playgroud)
它可以工作,但每当我使用时,facet_wrap()我最终只是尝试不同的排列,如何对其参数进行格式化.这是因为我不知道这些论点中的含义~或.含义.
有没有人对这些东西有什么简洁的描述?
我已经看到c#中使用的这个字符就像Java中的扩展一样,但最近我在代码中发现了这一点
loop: while (!stop) {}
还有"口袋:"....然后是一个for和in里面的那个"破口袋"; 我不知道这意味着什么.我将不胜感激任何解释.