图堆积条形图

时间:2012-07-06 17:27:41

标签: r

>  dput( Data )
structure(list(Returns = c(0.121898279, 0.13033722, 0.11481841, 
0.12036003, 0.114993592, 0.116188981, 0.121428867, 0.116709471, 
0.113210859, 0.113742848, 0.124184601, 0.115356057, 0.125204291, 
0.117456978, 0.105081626, 0.123955248, 0.108180176, 0.111982742, 
0.132430977, 0.11152048), A1 = c(0.001031969, 0.193967087, 0.080503515, 
0.040900369, 0.128328153, 0.156476201, 0.048047382, 0.095172939, 
0.165000886, 0.139207956, 0.053872589, 0.169413566, 0.075855391, 
0.194366833, 0.133996857, 0.087135623, 0.080431244, 0.145167653, 
0.109174761, 0.081604545), A2 = c(0.182100642, 0.182546906, 0.059195585, 
0.009377251, 0.078005805, 0.08951651, 0.041001956, 0.118467842, 
0.029851143, 0.164142907, 0.086745647, 0.062815491, 0.082917106, 
0.09218272, 0.009404369, 0.15153962, 0.052633842, 0.047654575, 
0.079980146, 0.07219003), A3 = c(0.033056468, 0.087089492, 0.071264136, 
0.032798067, 0.019900855, 0.068364162, 0.069405509, 0.066614578, 
0.05927698, 0.06150865, 0.118761761, 0.042341323, 0.06985265, 
0.056424585, 0.150445259, 0.043649925, 0.200761741, 0.038495841, 
0.058851104, 0.09678647), A4 = c(0.021989301, 0.14545256, 0.107609311, 
0.185294736, 0.107569414, 0.158398108, 0.010904275, 0.101427346, 
0.244391281, 0.001602613, 0.287120228, 0.082441453, 0.05741112, 
0.192793953, 0.186004376, 0.068749145, 0.196215868, 0.011002487, 
0.191050661, 0.142595017), A5 = c(0.079539686, 0.020485934, 0.156813654, 
0.180583799, 0.141910462, 0.143301472, 0.070897956, 0.122073368, 
0.12648414, 0.142742235, 0.05958849, 0.101874328, 0.053101605, 
0.18900444, 0.128629094, 0.007964965, 0.108247074, 0.187977017, 
0.021135936, 0.13692728), A6 = c(0.137558641, 0.058878856, 0.057730616, 
0.173227343, 0.128805897, 0.003212655, 0.013149668, 0.084112434, 
0.185654794, 0.166019731, 0.026406227, 0.187874107, 0.131080607, 
0.007525933, 0.016701075, 0.211947448, 0.143373161, 0.006260184, 
0.019667588, 0.142785301), A7 = c(0.096798666, 0.020255346, 0.036631967, 
0.113572471, 0.066622146, 0.079201897, 0.162091846, 0.114793711, 
0.016046429, 0.059351521, 0.040903589, 0.179164483, 0.160024011, 
0.127164369, 0.098604135, 0.124456001, 0.01027736, 0.275310865, 
0.034592344, 0.119706601), A8 = c(0.17643876, 0.02094711, 0.176338819, 
0.036208556, 0.137081653, 0.138326121, 0.192935751, 0.118875655, 
0.079709374, 0.074445331, 0.146749357, 0.009426806, 0.044459923, 
0.029539617, 0.196739901, 0.072512659, 0.118745585, 0.08939199, 
0.122734574, 0.099545584), A9 = c(0.181715746, 0.120409476, 0.005084759, 
0.139632432, 0.104908432, 0.12579961, 0.206737524, 0.091384469, 
0.020795676, 0.093603564, 0.133020593, 0.015143574, 0.145968537, 
0.077011395, 0.023159646, 0.197495552, 0.076733114, 0.107117743, 
0.208629473, 0.077884951), A10 = c(0.089770122, 0.149967232, 
0.248827638, 0.088404975, 0.086867182, 0.037403265, 0.184828133, 
0.087077656, 0.072789296, 0.097375493, 0.046831518, 0.149504869, 
0.179329052, 0.033986156, 0.056315287, 0.034549063, 0.012581012, 
0.091621645, 0.154183412, 0.029974221)), .Names = c("Returns", 
"A1", "A2", "A3", "A4", "A5", "A6", "A7", "A8", "A9", "A10"), row.names = c("prtf1", 
"prtf2", "prtf3", "prtf4", "prtf5", "prtf6", "prtf7", "prtf8", 
"prtf9", "prtf10", "prtf11", "prtf12", "prtf13", "prtf14", "prtf15", 
"prtf16", "prtf17", "prtf18", "prtf19", "prtf20"), class = "data.frame")

我需要一些帮助来绘制这个数据框。我正在看一个条形图,其中一个堆叠条的高度将对应于一行(并且该条中将有10个分区)

并且条形在x轴上的位置将取决于数据的第1列,即返回因此将形成x轴。

1 个答案:

答案 0 :(得分:0)

barplot(t(Data[order(Data[,1]),])[2:11,])

但我不知道我是否正确解释了你的问题。