An embedded and charset-unspecified text was scrubbed... Name: not available Url: https://stat.ethz.ch/pipermail/r-help/attachments/20050422/b39f22ed/attachment.pl
Need help arranging the plot in different fashion than the default format
2 messages · Ghosh, Sandeep, Marc Schwartz
On Fri, 2005-04-22 at 16:19 -0500, Ghosh, Sandeep wrote:
I want to change the way the plot is appearing in the barchart ..
testdata <- as.data.frame(t(structure(c
(1,2004,"LV1",3.8,2,87,2,2004,"LV1",3.2,3,28,3,2004,"LV1",3.4,3,88,4,2004,
"LV1",3,2,26,5,2004,"LV1",3.8,2,87,6,2004,"LV1",3.2,3,28,7,2004,"LV1",3.4,3,
88,8,2004,"LV1",3,2,26,9,2004,"LV1",3.8,2,87,10,2004,"LV1",3.2,3,28,11,2004,
"LV1",3.4,3,88,12,2004,"LV1",3,2,26,1,2005,"LV1",3.8,2,87,2,2005,"LV1",3.2,3,
28,3,2005,"LV1",3.4,3,88,4,2005,"LV1",3,2,26), .Dim=c(6,16))));
colnames(testdata) <- c('month', 'year',
'dataset','mean','stdDev','miceCount');
testdata[c("month", "mean")] <- lapply(testdata[c("month", "mean")],
function(x) as.numeric(levels(x)[x]));
testdata <- testdata[do.call("order", testdata), ];
trellis.par.set(theme = col.whitebg());
barchart(month ~ mean | year, data=testdata)
I want to have the years come one below the other rather than next to
each other which can be achieved by layout(c(1,2)), and the x axis to
be the month and the y axis to be the mean. I would really appreciate
if someone can tell me how to achieve this
barchart(mean ~ month | year, data=testdata, layout=c(1,2)) #doing
this is not producing the intended result
Any suggestion and help is greatly appreciated..
I suspect you want:
barchart(mean ~ month | year, data = testdata, horizontal = FALSE,
layout=c(1,2)
Note the use of 'horizontal = FALSE'
HTH,
Marc Schwartz