I would like to be able to shade between two lines using ggplot2 (with
faceting too).  But, despite reading all the documentation on the website,
cant figure out how to do it  (either because i am a novice or idiot - or,
of course, possibly both)

My data looks is readership of paid & free newspapers in london by age since
1994.  The structure is

reading.melt <-
structure(list(Date = structure(c(9100, 11292, 11657, 12022,
12387, 12753, 13118, 13483, 13757, 9100, 11292, 11657, 12022,
12387, 12753, 13118, 13483, 13757, 9100, 11292, 11657, 12022,
12387, 12753, 13118, 13483, 13757, 9100, 11292, 11657, 12022,
12387, 12753, 13118, 13483, 13757, 9100, 11292, 11657, 12022,
12387, 12753, 13118, 13483, 13757, 9100, 11292, 11657, 12022,
12387, 12753, 13118, 13483, 13757, 9100, 11292, 11657, 12022,
12387, 12753, 13118, 13483, 13757, 9100, 11292, 11657, 12022,
12387, 12753, 13118, 13483, 13757, 9100, 11292, 11657, 12022,
12387, 12753, 13118, 13483, 13757, 9100, 11292, 11657, 12022,
12387, 12753, 13118, 13483, 13757, 9100, 11292, 11657, 12022,
12387, 12753, 13118, 13483, 13757, 9100, 11292, 11657, 12022,
12387, 12753, 13118, 13483, 13757), class = "Date"), Geog = structure(c(1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = "London", class =
"factor"),
    Type = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L,
    2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
    1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L,
    1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L,
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
    2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L,
    2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L,
    2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L), .Label = c("Paid", "Total"
    ), class = "factor"), variable = structure(c(1L, 1L, 1L,
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
    2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
    2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
    3L, 3L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L,
    4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 5L, 5L, 5L, 5L, 5L, 5L,
    5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 6L, 6L, 6L,
    6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L
    ), .Label = c("Age.15.24", "Age.25.34", "Age.35.44", "Age.45.54",
    "Age.55.64", "Age.65."), class = "factor"), value = c(57.6,
    54.7, 44.9, 51.1, 43.5, 44.8, 44, 50, 39.6, 57.6, 54.7, 50.4,
    57.3, 55, 57.5, 52.5, 60.9, 59.7, 60.7, 51.9, 52.8, 53.5,
    43.5, 40.8, 47.5, 42.7, 34.4, 60.7, 51.9, 57.6, 58.7, 50.2,
    51.3, 59, 55.2, 56.5, 65.3, 56.9, 50.5, 54.9, 48.3, 53.3,
    43.7, 50.4, 42.2, 65.3, 56.9, 53.2, 58.1, 52.7, 57.6, 52.1,
    58.2, 55.4, 69.2, 67.2, 52.6, 61.4, 56.1, 49, 54.8, 51.5,
    45.2, 69.2, 67.2, 55.2, 63.6, 57.6, 53.6, 60.5, 57.2, 58.1,
    70.7, 64.5, 58.2, 64.7, 57.6, 62.1, 64.3, 61.8, 59.9, 70.7,
    64.5, 58.7, 66.3, 58.4, 67.2, 66.9, 63.5, 65.3, 67.5, 67.8,
    66.4, 70.2, 60.2, 64, 59.4, 59.7, 57.8, 67.5, 67.8, 66.4,
    70.3, 60.3, 64.7, 60, 61.1, 60.3)), .Names = c("Date", "Geog",
"Type", "variable", "value"), row.names = c(NA, -108L), class = "data.frame
")

I then run ...

p<-ggplot(reading.melt,aes(x=Date,y=value))
p+geom_path(aes(colour=Type),size=2)+facet_grid(variable~.)

but can't figure out
(1) How to add a transparent shade between the Paid & Total lines.  I've
tried the ribbon function, but cant seem to get it to shade between the
lines
(2) Add a left justified title to the chart

Any help very grateful received

thanks

simeon

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to