Thanks, Roman. I actually have three sets of graphs, bat activity sorted by small, medium, and large parks, with 9, 7, and 6 lines in each, respectively. Or I could just do 22 different facets, but grouping them by size makes sense biologically. I am trying to show activity over different seasons in each park.
Strangely, however, by playing around with this I can make more than six linetypes appear. They disappear when I put in the scale_linetype_manual command to set up the legend. I of course need this command to display a legend! I'm passing just a series 1:9 as the "values" in that command. Perhaps these are not the correct numbers to use to access more than six linetypes?
I'm going to put in sample code below. It includes my melted dataset and the ggplot commands. If you run just the first three lines of the ggplot command you should see more than 6 linetypes. But adding in the manual linetype command switches to a repeating set of six linetypes.
melted.sm <- structure(list(code = structure(c(1L, 2L, 4L, 5L, 9L, 10L, 11L,
12L, 19L, 1L, 2L, 4L, 5L, 9L, 10L, 11L, 12L, 19L, 1L, 2L, 4L,
5L, 9L, 10L, 11L, 12L, 19L, 1L, 2L, 4L, 5L, 9L, 10L, 11L, 12L,
19L), .Label = c("BG", "BH", "BV", "CH", "EH", "GB", "GC", "GG",
"GH", "GV", "HH", "KH", "LM", "MD", "ML", "P1", "P2", "PL", "TH",
"TP", "TR", "VU"), class = "factor"), park = structure(c(4L,
3L, 5L, 6L, 7L, 10L, 12L, 13L, 20L, 4L, 3L, 5L, 6L, 7L, 10L,
12L, 13L, 20L, 4L, 3L, 5L, 6L, 7L, 10L, 12L, 13L, 20L, 4L, 3L,
5L, 6L, 7L, 10L, 12L, 13L, 20L), .Label = c("B. Vista", "Bayview",
"Bernal", "Billygoat", "Corona", "Edgehill", "GG Hts", "GG Pk.",
"Glen Cyn", "Grandview", "Grn. Belt", "Hawk", "Kite", "Lk. Merced",
"Lobos Ck.", "McLaren", "Mt. David.", "Mtn. Lake", "Pine Lk.",
"Tank", "TP Res.", "Twin Pks."), class = "factor"), period = structure(c(1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 4L, 4L,
4L, 4L, 4L), .Label = c("May", "September", "December", "March"
), class = "factor"), passes = c(0L, 1L, 0L, 13L, 36L, 4L, 6L,
25L, 3L, 48L, 6L, 29L, 35L, 69L, 36L, 5L, 8L, 5L, 2L, 0L, 2L,
0L, 45L, 0L, 6L, 0L, 0L, 5L, 2L, 0L, 3L, 14L, 0L, 0L, 0L, 1L)), .Names = c("code",
"park", "period", "passes"), row.names = c(NA, 36L), class = "data.frame")
# some variables for the manual linetypes command
sm.linetypes <- c(1:9)
sm.codes <- c("BG", "BH","CH", "EH", "GH", "GV", "HH", "KH", "TH")
sm.names <- c("Billygoat","Bernal","Corona","Edgehill","GG Hts","Grandview","Hawk","Kite","Tank")
ggplot (data = melted.sm, aes(x = period, y = log(passes+1), group=code)) +
geom_line(aes(linetype=code)) +
geom_point() +
labs(y = "Log Bat Passes",
x = "Season") +
scale_linetype_manual ("Small\nParks\nActivity"),
breaks = sm.codes,
labels = sm.names,
values = sm.linetypes)