数据(删节版):
m1 1
m2 2
m3 3
m4 0
m5 32
m6 12
m7 42
m8 56
m9 29
注意:0应该代表我的图表中的空格
代码:
barplot(
name,
main="Mike vs. Ike" ,
ylab="Number of criminal offences of two different people" ,
xlab="" ,
col=c("yellow" , "blue" ) ,
beside=TRUE ,
ylim= range(0 , 10) ,
las=2 ,
axes=TRUE ,
names.arg = c("Mike: number of offences in: 1 day" ,
"Ike: number of offences in: 1 day" ,
"" ,
"Mike: number of offences in: 1 week" ,
"Ike: number of offences in: 1 week" ,
"" ,
"Mike: number of offences in: 1 month" ,
"Ike: number of offences in: 1 month" ,
"" ,
"Mike: number of offences in: 1 year" ,
"Mike: number of offences in: 1 year"
) ,
legend(
"topright" ,
c("Mike" , "Ike") ,
col=c("yellow" , "green") ,
pch=c(22:22) ,
cex=0.75 )
)
我得到错误:
Error in strwidth(legend, units = "user", cex = cex, font = text.font) :
plot.new has not been called yet
亿美元问题:
如何扩展我的names.arg
和legend
以适合我的图表
Danke提前
不要在这里阅读传递(堆栈说的代码太多)。
苹果橙苹果橙苹果橙苹果橙苹果橙苹果橙苹果橙苹果橙苹果橙苹果橙苹果橙苹果橙苹果橙苹果橙答案 0 :(得分:1)
我认为您的问题是,您在<{1}}内调用legend()
,而在之后应该调用。至少那就是给你错误的东西。但是,我不确定你通过“缩放”这个传奇或名字的确切含义。