[R] Plot help
Peter Francis
peterfrancis at me.com
Wed Oct 20 11:41:57 CEST 2010
Dear List,
I am relatively new to R and am trying to create more attractive plots than excel can manage!
I have looked through the various programmes ggplot, lattice, hmisc etc but my case seems to be not metnioned, maybe it is but i have not noticed - if this is the case i apologise.
*****************************************************************************************************************
#I have a series of simulated values, which are means
sim <- c(0.0012,0.0009,2,2,9,12,0.0009,2,19,1,1,0.0013,1,0.0009,0.0009,1,26,3,1,2,1,0.0009,1,0.2323,4,2,0.0009,0.0009,0.0009,52,49,1,3,7)
#and actual values
actual <- c(0,0,2,0,13,20,0,3,38,0,0,0,1,0,0,0,27,2,0,0,1,0,1,0,4,2,0,0,0,54,21,0,4,11)
#The "X" axes is family, ranging from 1-35, where the "Y" axes is sim and actual values.
#What i want to do is plot the simulated values with the 95% CI values, and then plot the actual values and see if they fall in the CI'S which they do. The idea is that there is no significant difference between the actual values and the simulated values.
#I thave Ci for sim and this is where the trouble begins!
simCI <- c(0.000908781,0.001248025,0.000928731,0.000885441,0.002384808,0.002700088,0.005377963,0.006202863,0.000918969,0.002566072,0.007687229,0.001593536,0.001578519,0.001299327,0.00217493,0.000908781,0.00090428,0.001550469,0.008840134,0.003300862,0.001546501,0.002775418,0.0014778,0.00090428,0.001546201,0.000898151,0.003446757,0.002854941,0.000863444,0.000918969,0.000924599,0.011732253,0.011488353,0.001788464)
# i then put this in a dataframe
simvsact <- data.frame(sim = sim, actual = actual, simCI.lower = sim - simCI, simCI.upper = sim + simCI, fam = factor(paste('Family', 1:34, sep = '')))
*****************************************************************************************************************
As afore mentioned i was looking at getting a x/y scatter plot ( i think this would be best, if not other suggestions would be greatly appreciated) with the CI range block highlighted and the actual line a different colour running through the CI range.
I hope this makes sense.
Peter
More information about the R-help
mailing list