我有这个错误每隔一列都在填满,但除了这个?
data=read.csv("data.csv")
attach(data)
data$marks<- factor(data$marks, levels = data$marks[order(data$a)])
c.data=melt(data, id.var="marks")
n.data = ddply(c.data,.(marks), transform, pos = cumsum(value) - 0.5*value)
plot = ggplot(n.data, aes(x = marks, y = value)) +
geom_bar(stat = "identity",aes(fill = variable)) +
geom_text(aes(label = value, y = pos), size = 3, face="bold",
colour="white") +
scale_fill_manual(values=c("#800000","#000000")) +
scale_y_continuous(limits=c(0, 100), breaks=seq(0,100, by = 10)) +
theme(axis.line = element_line(),
axis.text.x=element_text(angle=60,hjust=1,colour="white"),
axis.text.y=element_text(colour="white"),
axis.title.x = element_blank(),
axis.title.y = element_blank(),
panel.background = element_blank(),
axis.ticks=element_blank()) +
labs(fill="")
这是我使用的代码
Marks a b
1 49 51
2 53 47
3 54 46
4 54 46
5 55 45
6 55 45
7 55 45
8 55 45
9 55 45
10 56 45
11 56 45
12 56 44
13 56 44
14 56 44
15 56 44
16 56 44
17 57 44
18 57 43
19 57 43
20 58 42
21 58 42
22 59 41
23 60 40
24 60 40
25 61 39
26 61 39
27 61 39
28 62 38
29 62 38
30 62 38
31 64 36
32 64 36
33 67 33
34 71 29
这是使用的样本数据,我已经对点进行了四舍五入,以便得到整数