r - Increase space between x-axis factors in ggplot -


i using geom_pointrange function in ggplot2 in order plot spread of measurement on different condition 5 subjects. in order not have subjects overlap have constructed plot follows:

final = structure(list(subject = structure(c(1l, 1l, 1l, 1l, 1l, 1l,  1l, 1l, 2l, 2l, 2l, 2l, 2l, 2l, 2l, 2l, 3l, 3l, 3l, 3l, 3l, 3l,  3l, 3l, 4l, 4l, 4l, 4l, 4l, 4l, 4l, 4l, 5l, 5l, 5l, 5l, 5l, 5l,  5l, 5l), .label = c("1", "2", "3", "4", "5"), class = "factor"),      x00.conditionname = structure(c(1l, 1l, 2l, 2l, 3l, 3l, 4l,      4l, 1l, 1l, 2l, 2l, 3l, 3l, 4l, 4l, 1l, 1l, 2l, 2l, 3l, 3l,      4l, 4l, 1l, 1l, 2l, 2l, 3l, 3l, 4l, 4l, 1l, 1l, 2l, 2l, 3l,      3l, 4l, 4l), .label = c("eyeclose-haptic", "mixed-haptic_visual",      "only-haptic", "only-visual"), class = "factor"), x03.totaltargetnumber = c(2l,      3l, 2l, 3l, 2l, 3l, 2l, 3l, 2l, 3l, 2l, 3l, 2l, 3l, 2l, 3l,      2l, 3l, 2l, 3l, 2l, 3l, 2l, 3l, 2l, 3l, 2l, 3l, 2l, 3l, 2l,      3l, 2l, 3l, 2l, 3l, 2l, 3l, 2l, 3l), accuracy = c(0.075870763,      0.0907863686, 0.0222156611, 0.0492028585333333, 0.0301178471,      0.0736098328666667, 0.0329723832, 0.0455095300666667, 0.065151615,      0.0979033533333333, 0.0247176775, 0.0335825226666667, 0.027385248,      0.0462643053333333, 0.037272505, 0.0652166726666667, 0.043005086,      0.061848328, 0.031106749, 0.0275656054, 0.026701889, 0.0373967466666667,      0.028998468, 0.03219287, 0.0597213356, 0.0851717708333333,      0.030286913, 0.0779058462666667, 0.043368508, 0.051437624,      0.029002474, 0.0479204566666667, 0.094555739, 0.0856268291666667,      0.031908514, 0.0310441326666667, 0.036311762, 0.0496942306666667,      0.054625148, 0.0482682121666667), upperci = c(0.116082073022708,      0.139632763787946, 0.0315087794760623, 0.0727058964327625,      0.0468512606854127, 0.116787586356955, 0.0444933233012107,      0.062820743812494, 0.0858551911272202, 0.136013260005381,      0.0327074347874691, 0.0460471773903695, 0.035302995136302,      0.0740077338495226, 0.0641795522210299, 0.131047110446756,      0.0572545979325947, 0.0809511078363974, 0.0414215170576924,      0.0341480438532189, 0.0382253716300962, 0.0519626825555577,      0.0377955915789704, 0.0430125127419472, 0.0903928001427357,      0.114245467448517, 0.0461054194398361, 0.129350863514659,      0.0635159480110737, 0.0717647837071829, 0.0371919026867606,      0.0615899295823839, 0.170222051412597, 0.128502458351433,      0.046712862081242, 0.0388340720489338, 0.0574188259607336,      0.0786845830951613, 0.0844193698576058, 0.0784830058409822     ), lowerci = c(0.0356594529772922, 0.0419399734120541, 0.0129225427239377,      0.0256998206339042, 0.0133844335145873, 0.0304320793763786,      0.0214514430987893, 0.0281983163208393, 0.0444480388727798,      0.059793446661286, 0.0167279202125309, 0.0211178679429639,      0.019467500863698, 0.0185208768171441, 0.0103654577789701,      -0.000613765113422152, 0.0287555740674053, 0.0427455481636026,      0.0207919809423076, 0.0209831669467811, 0.0151784063699038,      0.0228308107777757, 0.0202013444210296, 0.0213732272580528,      0.0290498710572643, 0.0560980742181497, 0.0144684065601638,      0.0264608290186746, 0.0232210679889263, 0.0311104642928171,      0.0208130453132394, 0.0342509837509495, 0.018889426587403,      0.0427511999819006, 0.017104165918758, 0.0232541932843995,      0.0152046980392664, 0.0207038782381721, 0.0248309261423941,      0.0180534184923511), condlevel = c("eyeclose-haptic2", "eyeclose-haptic3",      "mixed-haptic_visual2", "mixed-haptic_visual3", "only-haptic2",      "only-haptic3", "only-visual2", "only-visual3", "eyeclose-haptic2",      "eyeclose-haptic3", "mixed-haptic_visual2", "mixed-haptic_visual3",      "only-haptic2", "only-haptic3", "only-visual2", "only-visual3",      "eyeclose-haptic2", "eyeclose-haptic3", "mixed-haptic_visual2",      "mixed-haptic_visual3", "only-haptic2", "only-haptic3", "only-visual2",      "only-visual3", "eyeclose-haptic2", "eyeclose-haptic3", "mixed-haptic_visual2",      "mixed-haptic_visual3", "only-haptic2", "only-haptic3", "only-visual2",      "only-visual3", "eyeclose-haptic2", "eyeclose-haptic3", "mixed-haptic_visual2",      "mixed-haptic_visual3", "only-haptic2", "only-haptic3", "only-visual2",      "only-visual3")), .names = c("subject", "x00.conditionname",  "x03.totaltargetnumber", "accuracy", "upperci", "lowerci", "condlevel" ), row.names = c(na, -40l), class = "data.frame")   require(ggplot2)  pdf("pilot2.pdf", w = 12, h = 8) limits <- aes(ymax = upperci, ymin=lowerci) baselayer = ggplot(data = final, aes (x = x00.conditionname, y = accuracy, color = subject, group = subject )) baselayer + geom_pointrange(limits, position=position_dodge(width=1), size = 1.5) +  theme(axis.text=element_text(size=14), axis.title=element_text(size=14), axis.text.x = element_text(angle = 25, hjust = 1)) +  facet_grid (.~x03.totaltargetnumber) + ggtitle ("pilot 2") + xlab ("condition") dev.off() 

plot not want rune example

as can see x-axis discrete, , points "crowded", difficult tell apart different categories.

is there way increase space between different categories ?

the best solutoin use facets create 8 separate tall , skinny plots these features separated thin white gutter between them solid label @ top. keep or lose x-axis labels. creates 1 figure of 8 graphs communicates better on big graph.

like this:stack-ggplot2-geom-pointrange-facet-grid-with-coord-flip

except yours verticle


Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

javascript - IE9 error '$'is not defined -