我可以找到解决以下问题的方法.我会非常感谢一些帮助!
以下代码使用facet生成条形图.但是,由于"额外空间"ggplot2在某些组中使得条形更宽,即使我指定宽度为0.1或类似.我发现这非常烦人,因为它使它看起来非常不专业.我希望所有的条看起来都一样(填充除外).我希望有人能告诉我如何解决这个问题.
其次,如何重新排序构面窗口中的不同类,以便顺序始终为C1,C2 ... C5,M,F,全部适用.我尝试了它来排序因子的级别,但由于并非所有的类都出现在每个图形部分中它都不起作用,或者至少我认为这就是原因.
第三,如何减少酒吧之间的空间?这样整个图形就更加压缩了.即使我将图像缩小以进行导出,R也会将条形缩小,但条形之间的间距仍然很大.
我希望得到任何答案的反馈!
我的数据:http: //pastebin.com/embed_iframe.php?i = kNVnmcR1
我的代码:
library(dplyr)
library(gdata)
library(ggplot2)
library(directlabels)
library(scales)
all<-read.xls('all_auto_visual_c.xls')
all$station<-as.factor(all$station)
#all$group.new<-factor(all$group, levels=c('C. hyperboreus','C. glacialis','Special Calanus','M. longa','Pseudocalanus sp.','Copepoda'))
allp <- ggplot(data = all, aes(x=shortname2, y=perc_correct, group=group,fill=sample_size)) +
geom_bar(aes(fill=sample_size),stat="identity", position="dodge", width=0.1, colour="NA") + scale_fill_gradient("Sample size (n)",low="lightblue",high="navyblue")+
facet_wrap(group~station,ncol=2,scales="free_x")+
xlab("Species and stages") + ylab("Automatic identification and visual validation concur (%)") +
ggtitle("Visual validation of predictions") +
theme_bw() +
theme(plot.title = element_text(lineheight=.8, face="bold", size=20,vjust=1), axis.text.x = element_text(colour="grey20",size=12,angle=0,hjust=.5,vjust=.5,face="bold"), axis.text.y = element_text(colour="grey20",size=12,angle=0,hjust=1,vjust=0,face="bold"), axis.title.x = element_text(colour="grey20",size=15,angle=0,hjust=.5,vjust=0,face="bold"), axis.title.y …Run Code Online (Sandbox Code Playgroud) 我想通过 OS X 的命令行终端查找文件,然后将找到的文件复制到新目录。我要查找的文件的文件名在 listexample.txt 文件中,其中大约有 5000 个文件名。
文件 listexample.txt 如下所示:
1111 00001 55553.bmp
1113 11312 24125.bmp
…
Run Code Online (Sandbox Code Playgroud)
我试过这样的事情:
find /directory -type f "`cat listexample.txt`" -exec cp {} …
Run Code Online (Sandbox Code Playgroud)
但无法让它运行。
我现在有这个,但它不起作用:
cat listexample.txt | while read line; do grep "$line" listexample.txt -exec find /directorya "$line" -exec cp {} /directoryb \; done
Run Code Online (Sandbox Code Playgroud)
这个想法是读取列表 example.txt 的行,然后使用 grep 获取该行,在目录 a 中找到文件,然后将找到的文件复制到新目录 b。我认为由于我的文件名的性质,见上文,名称中也存在空格问题。
我也开始使用这种方法来查看发生了什么,但并没有走多远。
for line in `cat listexample.txt`; do grep $line -exec echo "Processing $line"; done
Run Code Online (Sandbox Code Playgroud)