首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在格子中绘制带有方框x标签的图片?

如何在格子中绘制带有方框x标签的图片?
EN

Stack Overflow用户
提问于 2012-10-27 16:12:33
回答 2查看 148关注 0票数 0

如何在条形图中添加两条水平线?

如何像这样装箱我的x-labels?

http://wego.genomics.org.cn/pubs/rice_indica.pdf

Fig.9

另外,如何在右侧添加带自定义标签的y轴?

代码语言:javascript
复制
go=data.frame(number_of_Unigene=c(45,5328,30,30,119,3248,16594,244,4354,3547,917,429,3716,30,15726,4182,1673,877,30,30,640,4808,2462,2437,7812,190,2001,30,44,19852,1763,19852,31,30,686,30,3698,9829,3432,1439,15252,6024,1753,216,15917,15103,30,433,319,30,522,708,30,102,30,613,1039,30,2478),class=c("biological adhesion","biological regulation","carbon utilization","cell killing","cell proliferation","cellular component organization or biogenesis","cellular process","death","developmental process","establishment of localization","growth","immune system process","localization","locomotion","metabolic process","multicellular organismal process","multi-organism process","negative regulation of biological process","nitrogen utilization","pigmentation","positive regulation of biological process","regulation of biological process","reproduction","reproductive process","response to stimulus","rhythmic process","signaling","sulfur utilization","viral reproduction","cell","cell junction","cell part","extracellular matrix","extracellular matrix part","extracellular region","extracellular region part","macromolecular complex","membrane","membrane part","membrane-enclosed lumen","organelle","organelle part","symplast","antioxidant activity","binding","catalytic activity","channel regulator activity","electron carrier activity","enzyme regulator activity","metallochaperone activity","molecular transducer activity","nucleic acid binding transcription factor activity","nutrient reservoir activity","protein binding transcription factor activity","protein tag","receptor activity","structural molecule activity","translation regulator activity","transporter activity"),Ontology=c("biological_process","biological_process","biological_process","biological_process","biological_process","biological_process","biological_process","biological_process","biological_process","biological_process","biological_process","biological_process","biological_process","biological_process","biological_process","biological_process","biological_process","biological_process","biological_process","biological_process","biological_process","biological_process","biological_process","biological_process","biological_process","biological_process","biological_process","biological_process","biological_process","cellular_component","cellular_component","cellular_component","cellular_component","cellular_component","cellular_component","cellular_component","cellular_component","cellular_component","cellular_component","cellular_component","cellular_component","cellular_component","cellular_component","molecular_function","molecular_function","molecular_function","molecular_function","molecular_function","molecular_function","molecular_function","molecular_function","molecular_function","molecular_function","molecular_function","molecular_function","molecular_function","molecular_function","molecular_function","molecular_function"))


library(lattice)
newclass<-factor(go[,2],levels=unique(go[,2]))
barchart(go[,1]~newclass,horiz=F,ylim=c(30,29666),layout=c(1,1),stack=F,
auto.key=list(space='right'),ylab="Number of unigenes",
scales=list(x=list(rot=45),y=list(log=T)))
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2012-10-29 02:01:38

这可能有助于解决次要y轴问题。

代码语言:javascript
复制
library(lattice)
library(grid)  # needed for grid.text

# data

Lines.raw <- "Date  Fo  Co
day1  57.1  13.9
day2  57.7  14.3
day3  57.8  14.3
"

DF <- read.table(textConnection(Lines.raw), header = TRUE)


par.settings <- list(
    layout.widths = list(left.padding = 10, right.padding = 20),
    layout.heights = list(bottom.padding = 10, top.padding = 10)
)

barchart(Co ~ Date, DF, default.scales = list(y = list(relation = "free")),
    ylab = "C", par.settings = par.settings)

trellis.focus("panel", 1, 1, clip.off = TRUE)
  pr <- pretty(DF$Fo)
  at <- 5/9 * (pr - 32)
  panel.axis("right", at = at, lab = pr, outside = TRUE)
  grid.text("F", x = 1.1, rot = 90) # right y axis label
trellis.unfocus()

参考:http://markmail.org/message/zap4t22er3aoqhcz

票数 1
EN

Stack Overflow用户

发布于 2012-10-27 16:41:12

试试这个:

代码语言:javascript
复制
 require(ggplot2)
 ggplot(go, aes(x=class, y=number_of_Unigene))+facet_grid(~Ontology)+geom_bar()+ theme(axis.text=element_text(angle=45, hjust=1))+ scale_y_continuous("No of Unigenes")

有关其他调整,请访问此网站...

http://docs.ggplot2.org/current/

或者这个

http://wiki.stdout.org/rcookbook/Graphs/

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/13098430

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档