grid.arrange: error in switch?

343 views
Skip to first unread message

Hermann Norpois

unread,
Feb 24, 2013, 11:30:31 AM2/24/13
to ggplot2
Both ap and bp are plots produced by ggplot that work (added via dput). But grid.arrange does not function as expected and I dont understand why.


> grid.arrange (ap, bp, ncol=2)
Fehler in switch(ct, ggplot = ggplotGrob(grobs[[ii.table]]), trellis = latticeGrob(grobs[[ii.table]]),  :
  EXPR muss ein Vektor der Länge 1 sein

"EXPR must be a vector of length 1"

Thanks
Hermann


> sessionInfo ()
R version 2.15.2 (2012-10-26)
Platform: i686-pc-linux-gnu (32-bit)

locale:
 [1] LC_CTYPE=de_DE.UTF-8       LC_NUMERIC=C             
 [3] LC_TIME=de_DE.UTF-8        LC_COLLATE=de_DE.UTF-8   
 [5] LC_MONETARY=de_DE.UTF-8    LC_MESSAGES=de_DE.UTF-8  
 [7] LC_PAPER=C                 LC_NAME=C                
 [9] LC_ADDRESS=C               LC_TELEPHONE=C           
[11] LC_MEASUREMENT=de_DE.UTF-8 LC_IDENTIFICATION=C      

attached base packages:
[1] grid      stats     graphics  grDevices utils     datasets  methods 
[8] base    

other attached packages:
 [1] gridExtra_0.8.1        HiTC_1.2.0             girafe_1.10.0        
 [4] genomeIntervals_1.14.0 intervals_0.13.3       ShortRead_1.16.3     
 [7] latticeExtra_0.6-24    RColorBrewer_1.0-5     lattice_0.20-13      
[10] Rsamtools_1.10.2       Biostrings_2.26.3      GenomicRanges_1.10.6 
[13] IRanges_1.16.4         BiocGenerics_0.4.0     ggplot2_0.9.3        

loaded via a namespace (and not attached):
 [1] Biobase_2.18.0   bitops_1.0-5     BSgenome_1.26.1  colorspace_1.2-1
 [5] compiler_2.15.2  dichromat_2.0-0  digest_0.6.2     gtable_0.1.2   
 [9] hwriter_1.3      labeling_0.1     MASS_7.3-23      munsell_0.4    
[13] parallel_2.15.2  plyr_1.8         proto_0.3-10     reshape2_1.2.2 
[17] scales_0.2.3     stats4_2.15.2    stringr_0.6.2    tools_2.15.2   
[21] zlibbioc_1.4.0 


> dput (ap)
structure(list(data = structure(list(n = 1:230, freq = c(0L,
0L, 0L, 0L, 0L, 18L, 136L, 227L, 338L, 422L, 528L, 552L, 644L,
627L, 655L, 735L, 816L, 815L, 837L, 908L, 911L, 965L, 1034L,
1070L, 1022L, 1050L, 1101L, 1131L, 1148L, 1181L, 1216L, 1154L,
1161L, 1249L, 1222L, 1231L, 1204L, 1224L, 1204L, 1277L, 1258L,
1307L, 1276L, 1183L, 1240L, 1226L, 1292L, 1242L, 1239L, 1186L,
1184L, 1221L, 1208L, 1186L, 1216L, 1193L, 1107L, 1155L, 1111L,
1121L, 1107L, 1182L, 1077L, 1046L, 1092L, 998L, 1014L, 990L,
998L, 1008L, 981L, 993L, 942L, 883L, 900L, 929L, 859L, 790L,
813L, 801L, 776L, 757L, 704L, 664L, 714L, 677L, 635L, 594L, 592L,
611L, 590L, 543L, 540L, 515L, 498L, 496L, 475L, 489L, 407L, 411L,
437L, 377L, 364L, 357L, 347L, 343L, 338L, 354L, 290L, 308L, 321L,
313L, 282L, 294L, 268L, 240L, 255L, 231L, 250L, 205L, 241L, 212L,
221L, 209L, 188L, 200L, 181L, 187L, 170L, 169L, 146L, 167L, 152L,
143L, 144L, 148L, 141L, 165L, 125L, 144L, 151L, 120L, 122L, 112L,
135L, 119L, 128L, 112L, 95L, 123L, 111L, 97L, 108L, 108L, 88L,
123L, 100L, 80L, 97L, 93L, 99L, 87L, 92L, 90L, 77L, 85L, 63L,
76L, 92L, 75L, 55L, 67L, 69L, 68L, 49L, 73L, 70L, 74L, 63L, 68L,
57L, 60L, 67L, 47L, 53L, 47L, 61L, 47L, 48L, 44L, 44L, 57L, 37L,
40L, 52L, 39L, 53L, 47L, 44L, 46L, 45L, 39L, 35L, 38L, 49L, 35L,
35L, 35L, 48L, 36L, 38L, 31L, 33L, 31L, 29L, 23L, 39L, 42L, 34L,
32L, 37L, 32L, 39L, 33L, 30L, 28L, 27L, 30L, 19L, 21L), kum = c(0L,
0L, 0L, 0L, 0L, 18L, 154L, 381L, 719L, 1141L, 1669L, 2221L, 2865L,
3492L, 4147L, 4882L, 5698L, 6513L, 7350L, 8258L, 9169L, 10134L,
11168L, 12238L, 13260L, 14310L, 15411L, 16542L, 17690L, 18871L,
20087L, 21241L, 22402L, 23651L, 24873L, 26104L, 27308L, 28532L,
29736L, 31013L, 32271L, 33578L, 34854L, 36037L, 37277L, 38503L,
39795L, 41037L, 42276L, 43462L, 44646L, 45867L, 47075L, 48261L,
49477L, 50670L, 51777L, 52932L, 54043L, 55164L, 56271L, 57453L,
58530L, 59576L, 60668L, 61666L, 62680L, 63670L, 64668L, 65676L,
66657L, 67650L, 68592L, 69475L, 70375L, 71304L, 72163L, 72953L,
73766L, 74567L, 75343L, 76100L, 76804L, 77468L, 78182L, 78859L,
79494L, 80088L, 80680L, 81291L, 81881L, 82424L, 82964L, 83479L,
83977L, 84473L, 84948L, 85437L, 85844L, 86255L, 86692L, 87069L,
87433L, 87790L, 88137L, 88480L, 88818L, 89172L, 89462L, 89770L,
90091L, 90404L, 90686L, 90980L, 91248L, 91488L, 91743L, 91974L,
92224L, 92429L, 92670L, 92882L, 93103L, 93312L, 93500L, 93700L,
93881L, 94068L, 94238L, 94407L, 94553L, 94720L, 94872L, 95015L,
95159L, 95307L, 95448L, 95613L, 95738L, 95882L, 96033L, 96153L,
96275L, 96387L, 96522L, 96641L, 96769L, 96881L, 96976L, 97099L,
97210L, 97307L, 97415L, 97523L, 97611L, 97734L, 97834L, 97914L,
98011L, 98104L, 98203L, 98290L, 98382L, 98472L, 98549L, 98634L,
98697L, 98773L, 98865L, 98940L, 98995L, 99062L, 99131L, 99199L,
99248L, 99321L, 99391L, 99465L, 99528L, 99596L, 99653L, 99713L,
99780L, 99827L, 99880L, 99927L, 99988L, 100035L, 100083L, 100127L,
100171L, 100228L, 100265L, 100305L, 100357L, 100396L, 100449L,
100496L, 100540L, 100586L, 100631L, 100670L, 100705L, 100743L,
100792L, 100827L, 100862L, 100897L, 100945L, 100981L, 101019L,
101050L, 101083L, 101114L, 101143L, 101166L, 101205L, 101247L,
101281L, 101313L, 101350L, 101382L, 101421L, 101454L, 101484L,
101512L, 101539L, 101569L, 101588L, 101609L)), .Names = c("n",
"freq", "kum"), row.names = c(NA, -230L), class = "data.frame"),
    layers = list(<environment>), scales = <S4 object of class structure("Scales", package = "ggplot2")>,
    mapping = structure(list(), class = "uneval"), theme = list(),
    coordinates = structure(list(limits = structure(list(x = NULL,
        y = NULL), .Names = c("x", "y"))), .Names = "limits", class = c("cartesian",
    "coord")), facet = structure(list(shrink = TRUE), .Names = "shrink", class = c("null",
    "facet")), plot_env = <environment>, labels = structure(list(
        y = "Frequency", x = "bins", title = "GSM1008569 DHS\n5 bps per bin"), .Names = c("y",
    "x", "title"))), .Names = c("data", "layers", "scales", "mapping",
"theme", "coordinates", "facet", "plot_env", "labels"), class = c("gg",
"ggplot"))
> dput (bp)
structure(list(data = structure(list(n = 1:385, freq = c(0L,
0L, 0L, 0L, 0L, 0L, 24L, 63L, 158L, 250L, 293L, 402L, 491L, 515L,
581L, 642L, 704L, 742L, 813L, 832L, 816L, 865L, 829L, 887L, 911L,
941L, 924L, 995L, 979L, 1045L, 1010L, 1083L, 1040L, 1085L, 1065L,
1062L, 1036L, 1081L, 1081L, 1011L, 1087L, 1046L, 1078L, 1110L,
1062L, 1063L, 1072L, 1012L, 1007L, 1024L, 1069L, 1033L, 1047L,
986L, 945L, 1009L, 990L, 1021L, 953L, 915L, 928L, 932L, 918L,
873L, 847L, 863L, 843L, 812L, 809L, 813L, 775L, 776L, 769L, 788L,
715L, 727L, 679L, 714L, 671L, 667L, 631L, 689L, 593L, 668L, 602L,
599L, 581L, 550L, 538L, 532L, 530L, 581L, 519L, 515L, 464L, 478L,
476L, 437L, 416L, 439L, 421L, 358L, 412L, 397L, 377L, 359L, 381L,
347L, 344L, 341L, 309L, 310L, 316L, 258L, 313L, 292L, 286L, 257L,
272L, 252L, 271L, 245L, 243L, 225L, 253L, 209L, 225L, 206L, 211L,
203L, 235L, 234L, 211L, 195L, 211L, 193L, 180L, 190L, 187L, 179L,
172L, 164L, 178L, 165L, 188L, 147L, 174L, 180L, 157L, 157L, 152L,
174L, 165L, 139L, 142L, 131L, 161L, 158L, 126L, 114L, 137L, 144L,
123L, 123L, 120L, 112L, 112L, 138L, 138L, 115L, 116L, 129L, 114L,
97L, 116L, 114L, 123L, 96L, 93L, 107L, 91L, 101L, 93L, 99L, 77L,
88L, 92L, 112L, 86L, 106L, 79L, 73L, 84L, 72L, 77L, 88L, 81L,
95L, 84L, 83L, 77L, 62L, 61L, 65L, 63L, 50L, 70L, 73L, 61L, 65L,
56L, 72L, 58L, 62L, 72L, 69L, 61L, 70L, 70L, 55L, 64L, 62L, 67L,
54L, 67L, 50L, 58L, 61L, 46L, 52L, 57L, 57L, 48L, 44L, 48L, 46L,
35L, 41L, 50L, 54L, 55L, 48L, 56L, 59L, 55L, 45L, 37L, 38L, 31L,
47L, 56L, 41L, 38L, 31L, 30L, 42L, 44L, 50L, 43L, 46L, 26L, 34L,
30L, 34L, 34L, 38L, 32L, 37L, 31L, 30L, 29L, 35L, 28L, 36L, 37L,
25L, 33L, 31L, 30L, 39L, 31L, 28L, 28L, 20L, 27L, 35L, 30L, 24L,
26L, 39L, 30L, 28L, 22L, 17L, 23L, 27L, 29L, 30L, 22L, 26L, 30L,
22L, 24L, 31L, 26L, 30L, 22L, 28L, 20L, 21L, 22L, 22L, 22L, 30L,
21L, 21L, 20L, 18L, 23L, 20L, 21L, 19L, 21L, 16L, 24L, 27L, 19L,
17L, 14L, 18L, 19L, 22L, 14L, 19L, 16L, 27L, 19L, 15L, 16L, 13L,
22L, 16L, 28L, 23L, 21L, 14L, 16L, 14L, 16L, 17L, 10L, 21L, 11L,
17L, 13L, 21L, 12L, 18L, 13L, 18L, 17L, 14L, 14L, 13L, 15L, 15L,
9L, 16L, 16L, 21L, 15L, 17L, 19L, 10L, 12L, 9L, 19L, 23L, 9L,
18L, 10L, 9L, 11L, 12L, 10L), kum = c(0L, 0L, 0L, 0L, 0L, 0L,
24L, 87L, 245L, 495L, 788L, 1190L, 1681L, 2196L, 2777L, 3419L,
4123L, 4865L, 5678L, 6510L, 7326L, 8191L, 9020L, 9907L, 10818L,
11759L, 12683L, 13678L, 14657L, 15702L, 16712L, 17795L, 18835L,
19920L, 20985L, 22047L, 23083L, 24164L, 25245L, 26256L, 27343L,
28389L, 29467L, 30577L, 31639L, 32702L, 33774L, 34786L, 35793L,
36817L, 37886L, 38919L, 39966L, 40952L, 41897L, 42906L, 43896L,
44917L, 45870L, 46785L, 47713L, 48645L, 49563L, 50436L, 51283L,
52146L, 52989L, 53801L, 54610L, 55423L, 56198L, 56974L, 57743L,
58531L, 59246L, 59973L, 60652L, 61366L, 62037L, 62704L, 63335L,
64024L, 64617L, 65285L, 65887L, 66486L, 67067L, 67617L, 68155L,
68687L, 69217L, 69798L, 70317L, 70832L, 71296L, 71774L, 72250L,
72687L, 73103L, 73542L, 73963L, 74321L, 74733L, 75130L, 75507L,
75866L, 76247L, 76594L, 76938L, 77279L, 77588L, 77898L, 78214L,
78472L, 78785L, 79077L, 79363L, 79620L, 79892L, 80144L, 80415L,
80660L, 80903L, 81128L, 81381L, 81590L, 81815L, 82021L, 82232L,
82435L, 82670L, 82904L, 83115L, 83310L, 83521L, 83714L, 83894L,
84084L, 84271L, 84450L, 84622L, 84786L, 84964L, 85129L, 85317L,
85464L, 85638L, 85818L, 85975L, 86132L, 86284L, 86458L, 86623L,
86762L, 86904L, 87035L, 87196L, 87354L, 87480L, 87594L, 87731L,
87875L, 87998L, 88121L, 88241L, 88353L, 88465L, 88603L, 88741L,
88856L, 88972L, 89101L, 89215L, 89312L, 89428L, 89542L, 89665L,
89761L, 89854L, 89961L, 90052L, 90153L, 90246L, 90345L, 90422L,
90510L, 90602L, 90714L, 90800L, 90906L, 90985L, 91058L, 91142L,
91214L, 91291L, 91379L, 91460L, 91555L, 91639L, 91722L, 91799L,
91861L, 91922L, 91987L, 92050L, 92100L, 92170L, 92243L, 92304L,
92369L, 92425L, 92497L, 92555L, 92617L, 92689L, 92758L, 92819L,
92889L, 92959L, 93014L, 93078L, 93140L, 93207L, 93261L, 93328L,
93378L, 93436L, 93497L, 93543L, 93595L, 93652L, 93709L, 93757L,
93801L, 93849L, 93895L, 93930L, 93971L, 94021L, 94075L, 94130L,
94178L, 94234L, 94293L, 94348L, 94393L, 94430L, 94468L, 94499L,
94546L, 94602L, 94643L, 94681L, 94712L, 94742L, 94784L, 94828L,
94878L, 94921L, 94967L, 94993L, 95027L, 95057L, 95091L, 95125L,
95163L, 95195L, 95232L, 95263L, 95293L, 95322L, 95357L, 95385L,
95421L, 95458L, 95483L, 95516L, 95547L, 95577L, 95616L, 95647L,
95675L, 95703L, 95723L, 95750L, 95785L, 95815L, 95839L, 95865L,
95904L, 95934L, 95962L, 95984L, 96001L, 96024L, 96051L, 96080L,
96110L, 96132L, 96158L, 96188L, 96210L, 96234L, 96265L, 96291L,
96321L, 96343L, 96371L, 96391L, 96412L, 96434L, 96456L, 96478L,
96508L, 96529L, 96550L, 96570L, 96588L, 96611L, 96631L, 96652L,
96671L, 96692L, 96708L, 96732L, 96759L, 96778L, 96795L, 96809L,
96827L, 96846L, 96868L, 96882L, 96901L, 96917L, 96944L, 96963L,
96978L, 96994L, 97007L, 97029L, 97045L, 97073L, 97096L, 97117L,
97131L, 97147L, 97161L, 97177L, 97194L, 97204L, 97225L, 97236L,
97253L, 97266L, 97287L, 97299L, 97317L, 97330L, 97348L, 97365L,
97379L, 97393L, 97406L, 97421L, 97436L, 97445L, 97461L, 97477L,
97498L, 97513L, 97530L, 97549L, 97559L, 97571L, 97580L, 97599L,
97622L, 97631L, 97649L, 97659L, 97668L, 97679L, 97691L, 97701L
)), .Names = c("n", "freq", "kum"), row.names = c(NA, -385L), class = "data.frame"),
    layers = list(<environment>), scales = <S4 object of class structure("Scales", package = "ggplot2")>,
    mapping = structure(list(), class = "uneval"), theme = list(),
    coordinates = structure(list(limits = structure(list(x = NULL,
        y = NULL), .Names = c("x", "y"))), .Names = "limits", class = c("cartesian",
    "coord")), facet = structure(list(shrink = TRUE), .Names = "shrink", class = c("null",
    "facet")), plot_env = <environment>, labels = structure(list(
        y = "Frequency", x = "bins", title = "GSM1008578 DHS\n5 bps per bin"), .Names = c("y",
    "x", "title"))), .Names = c("data", "layers", "scales", "mapping",
"theme", "coordinates", "facet", "plot_env", "labels"), class = c("gg",
"ggplot"))
>

baptiste auguie

unread,
Feb 24, 2013, 3:57:55 PM2/24/13
to Hermann Norpois, ggplot2
The output of dput() is not usable for some reason, but my guess is that you should update to the latest version of gridExtra. See the NEWS file for 0.9.1:

https://github.com/baptiste/gridextra/blob/master/NEWS

HTH,

b.

--
--
You received this message because you are subscribed to the ggplot2 mailing list.
Please provide a reproducible example: https://github.com/hadley/devtools/wiki/Reproducibility
 
To post: email ggp...@googlegroups.com
To unsubscribe: email ggplot2+u...@googlegroups.com
More options: http://groups.google.com/group/ggplot2
 
---
You received this message because you are subscribed to the Google Groups "ggplot2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ggplot2+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply all
Reply to author
Forward
0 new messages