【发布时间】:2014-05-07 01:08:43
【问题描述】:
我的图例、缩放文本和命名单个轴时遇到问题
代码:
youtube_1 <- c(1)
youtube_2 <- c(2)
youtube <- rbind( youtube_1 , youtube_2)
facebook_1 <- c(6)
facebook_2 <- c(3)
facebook <- rbind( facebook_1 , facebook_2)
twitter_1 <- c(3)
twitter_2 <- c(1)
twitter <- rbind(twitter_1 , twitter_2)
groups <- rbind(youtube , space , facebook , space , twitter , space)
barplot(
groups ,
main="Rating" ,
ylab="Number of votes over time (people under 50 vs, people over 50)" ,
xlab="Year 1 , Year 2 , Year 3 " ,
col=c("yellow" , "green" ) ,
beside=TRUE ,
ylim= range(0 , 10) ,
legend("topright" , legend=c("Young" , "Old") , col=c("yellow" , "green")) ,
)
当我让 R 做这件事时,它给了我:
- 我的图例背后隐藏着一张图 :(
- 与图表相比,y 轴的比例太大
- 未标记单个条形
-
我也遇到了这个丑陋的错误:
宽度/2 错误:二元运算符的非数字参数 另外:警告信息: 在 mean.default(width) 中:参数不是数字或逻辑:返回 NA
我想要:
- 图例要远离图形“区域”
- 缩放轴的文本
- 标记每个单独的条
- 在 y 轴上标记一个单独的点(例如 5),并在理想情况下通过该点画一条线
我也是 R 的新手,所以请慢慢来,对于傻瓜请:)
【问题讨论】: