I want to display an area chart with Actual and Cumulative values. While I would expect that the Actual values would be displayed lower than Cumulative the opposite happens and also displays the chart in a very strange way.
Tar<-structure(list(Week = structure(c(1L, 1L, 15L, 15L, 20L, 20L,
8L, 8L, 3L, 3L, 18L, 18L, 16L, 16L, 14L, 14L, 5L, 5L, 14L, 14L,
15L, 15L, 8L, 8L, 10L, 10L, 19L, 19L, 5L, 5L, 17L, 17L, 20L,
20L, 18L, 18L, 18L, 18L, 2L, 2L, 3L, 3L, 8L, 8L, 20L, 20L, 20L,
20L, 7L, 7L, 5L, 5L, 2L, 2L, 18L, 18L, 16L, 16L, 7L, 7L, 20L,
20L, 17L, 17L, 20L, 20L, 20L, 20L, 5L, 5L, 15L, 15L, 16L, 16L,
6L, 6L, 14L, 14L, 20L, 20L, 15L, 15L, 8L, 8L, 18L, 18L, 14L,
14L, 16L, 16L, 18L, 18L, 5L, 5L, 5L, 5L, 20L, 20L, 20L, 20L,
20L, 20L, 1L, 1L, 16L, 16L, 7L, 7L, 9L, 9L, 15L, 15L, 18L, 18L,
20L, 20L, 15L, 15L, 3L, 3L, 19L, 19L, 14L, 14L, 17L, 17L, 10L,
10L, 20L, 20L, 9L, 9L, 18L, 18L, 18L, 18L, 14L, 14L, 5L, 5L,
18L, 18L, 14L, 14L, 9L, 9L, 17L, 17L, 16L, 16L, 9L, 9L, 10L,
10L, 14L, 14L, 15L, 15L, 7L, 7L, 20L, 20L, 20L, 20L, 10L, 10L,
18L, 18L, 10L, 10L, 20L, 20L, 11L, 11L, 8L, 8L, 17L, 17L, 15L,
15L, 20L, 20L, 15L, 15L, 11L, 11L, 8L, 8L, 5L, 5L, 16L, 16L,
7L, 7L, 14L, 14L, 15L, 15L, 14L, 14L, 17L, 17L, 14L, 14L, 20L,
20L, 14L, 14L, 15L, 15L, 14L, 14L, 5L, 5L, 19L, 19L, 18L, 18L,
14L, 14L, 3L, 3L, 14L, 14L, 8L, 8L, 14L, 14L, 15L, 15L, 3L, 3L,
20L, 20L, 5L, 5L, 20L, 20L, 17L, 17L, 19L, 19L, 8L, 8L, 8L, 8L,
9L, 9L, 14L, 14L, 3L, 3L, 20L, 20L, 19L, 19L, 17L, 17L, 3L, 3L,
14L, 14L, 1L, 1L, 16L, 16L, 18L, 18L, 18L, 18L, 20L, 20L, 18L,
18L, 16L, 16L, 16L, 16L, 7L, 7L, 15L, 15L, 20L, 20L, 17L, 17L,
8L, 8L, 16L, 16L, 15L, 15L, 3L, 3L, 19L, 19L, 15L, 15L, 17L,
17L, 2L, 2L, 20L, 20L, 10L, 10L, 16L, 16L, 14L, 14L, 8L, 8L,
18L, 18L, 6L, 6L, 10L, 10L, 17L, 17L, 3L, 3L, 17L, 17L, 18L,
18L, 18L, 18L, 14L, 14L, 15L, 15L, 14L, 14L, 14L, 14L, 18L, 18L,
16L, 16L, 14L, 14L, 4L, 4L, 18L, 18L, 13L, 13L, 6L, 6L, 14L,
14L, 15L, 15L, 14L, 14L, 3L, 3L, 16L, 16L, 18L, 18L, 4L, 4L,
2L, 2L, 8L, 8L, 3L, 3L, 14L, 14L, 5L, 5L, 18L, 18L, 8L, 8L, 19L,
19L, 17L, 17L, 14L, 14L, 17L, 17L, 20L, 20L, 17L, 17L, 15L, 15L,
18L, 18L, 10L, 10L, 2L, 2L, 15L, 15L, 8L, 8L, 14L, 14L, 16L,
16L, 14L, 14L, 5L, 5L, 19L, 19L, 5L, 5L, 4L, 4L, 17L, 17L, 6L,
6L, 6L, 6L, 4L, 4L, 13L, 13L, 18L, 18L, 2L, 2L, 17L, 17L, 14L,
14L, 20L, 20L, 6L, 6L, 3L, 3L, 15L, 15L, 18L, 18L, 6L, 6L, 3L,
3L, 20L, 20L, 11L, 11L, 20L, 20L, 16L, 16L, 8L, 8L, 18L, 18L,
7L, 7L, 14L, 14L, 1L, 1L, 4L, 4L, 20L, 20L, 20L, 20L, 8L, 8L,
18L, 18L, 1L, 1L, 14L, 14L, 4L, 4L, 14L, 14L, 18L, 18L, 4L, 4L,
5L, 5L, 6L, 6L, 20L, 20L, 2L, 2L, 8L, 8L, 18L, 18L, 18L, 18L,
15L, 15L, 7L, 7L, 17L, 17L, 20L, 20L, 8L, 8L, 5L, 5L, 16L, 16L,
13L, 13L, 12L, 12L, 16L, 16L, 17L, 17L, 20L, 20L, 9L, 9L, 4L,
4L, 14L, 14L, 15L, 15L, 20L, 20L, 5L, 5L, 18L, 18L, 4L, 4L, 16L,
16L, 2L, 2L, 6L, 6L, 7L, 7L, 3L, 3L, 13L, 13L, 13L, 13L, 20L,
20L, 18L, 18L, 17L, 17L, 14L, 14L, 18L, 18L, 12L, 12L, 7L, 7L,
20L, 20L, 4L, 4L, 13L, 13L, 6L, 6L, 5L, 5L, 6L, 6L, 20L, 20L,
20L, 20L, 14L, 14L, 6L, 6L, 5L, 5L, 4L, 4L, 2L, 2L, 17L, 17L,
9L, 9L, 15L, 15L, 16L, 16L, 18L, 18L, 16L, 16L, 4L, 4L, 6L, 6L,
13L, 13L, 17L, 17L, 8L, 8L, 17L, 17L, 7L, 7L, 5L, 5L, 15L, 15L,
1L, 1L, 6L, 6L, 4L, 4L, 20L, 20L, 5L, 5L, 3L, 3L, 6L, 6L, 20L,
20L, 13L, 13L, 8L, 8L, 18L, 18L, 4L, 4L, 7L, 7L, 5L, 5L, 6L,
6L, 16L, 16L, 18L, 18L, 20L, 20L, 20L, 20L, 20L, 20L, 6L, 6L,
13L, 13L, 5L, 5L, 16L, 16L, 17L, 17L, 6L, 6L, 13L, 13L, 8L, 8L,
15L, 15L, 6L, 6L, 4L, 4L, 8L, 8L, 13L, 13L, 3L, 3L, 6L, 6L, 20L,
20L, 18L, 18L, 6L, 6L, 13L, 13L, 14L, 14L, 11L, 11L, 8L, 8L,
7L, 7L, 4L, 4L, 16L, 16L, 16L, 16L, 17L, 17L, 1L, 1L, 5L, 5L,
17L, 17L, 5L, 5L, 20L, 20L, 20L, 20L, 4L, 4L, 6L, 6L, 15L, 15L,
7L, 7L, 18L, 18L, 17L, 17L, 17L, 17L, 3L, 3L, 5L, 5L, 18L, 18L,
16L, 16L, 18L, 18L, 18L, 18L, 20L, 20L, 6L, 6L, 16L, 16L, 2L,
2L, 8L, 8L, 20L, 20L, 16L, 16L, 6L, 6L, 8L, 8L, 3L, 3L, 15L,
15L, 16L, 16L, 19L, 19L, 16L, 16L, 18L, 18L, 5L, 5L, 17L, 17L,
4L, 4L, 6L, 6L, 16L, 16L, 6L, 6L, 20L, 20L, 17L, 17L, 7L, 7L,
7L, 7L, 2L, 2L, 18L, 18L, 18L, 18L, 20L, 20L, 7L, 7L, 16L, 16L,
2L, 2L, 15L, 15L, 20L, 20L, 15L, 15L, 4L, 4L, 5L, 5L, 16L, 16L,
6L, 6L, 19L, 19L, 3L, 3L, 18L, 18L, 6L, 6L, 7L, 7L, 18L, 18L,
20L, 20L, 17L, 17L, 18L, 18L, 6L, 6L, 9L, 9L), .Label = c("1",
"2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13",
"14", "15", "16", "17", "18", "19", "20"), class = "factor"),
Type = c("Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target", "Cumilative target",
"Actual target", "Cumilative target", "Actual target"), Count = c(5,
7, 323, 29, 448, 52, 148, 25, 28, 19, 398, 47, 348, 33, 298,
37, 73, 27, 298, 37, 323, 29, 148, 25, 198, 8, 423, 10, 73,
27, 373, 31, 448, 52, 398, 47, 398, 47, 13, 12, 28, 19, 148,
25, 448, 52, 448, 52, 123, 18, 73, 27, 13, 12, 398, 47, 348,
33, 123, 18, 448, 52, 373, 31, 448, 52, 448, 52, 73, 27,
323, 29, 348, 33, 98, 29, 298, 37, 448, 52, 323, 29, 148,
25, 398, 47, 298, 37, 348, 33, 398, 47, 73, 27, 73, 27, 448,
52, 448, 52, 448, 52, 5, 7, 348, 33, 123, 18, 173, 8, 323,
29, 398, 47, 448, 52, 323, 29, 28, 19, 423, 10, 298, 37,
373, 31, 198, 8, 448, 52, 173, 8, 398, 47, 398, 47, 298,
37, 73, 27, 398, 47, 298, 37, 173, 8, 373, 31, 348, 33, 173,
8, 198, 8, 298, 37, 323, 29, 123, 18, 448, 52, 448, 52, 198,
8, 398, 47, 198, 8, 448, 52, 223, 4, 148, 25, 373, 31, 323,
29, 448, 52, 323, 29, 223, 4, 148, 25, 73, 27, 348, 33, 123,
18, 298, 37, 323, 29, 298, 37, 373, 31, 298, 37, 448, 52,
298, 37, 323, 29, 298, 37, 73, 27, 423, 10, 398, 47, 298,
37, 28, 19, 298, 37, 148, 25, 298, 37, 323, 29, 28, 19, 448,
52, 73, 27, 448, 52, 373, 31, 423, 10, 148, 25, 148, 25,
173, 8, 298, 37, 28, 19, 448, 52, 423, 10, 373, 31, 28, 19,
298, 37, 5, 7, 348, 33, 398, 47, 398, 47, 448, 52, 398, 47,
348, 33, 348, 33, 123, 18, 323, 29, 448, 52, 373, 31, 148,
25, 348, 33, 323, 29, 28, 19, 423, 10, 323, 29, 373, 31,
13, 12, 448, 52, 198, 8, 348, 33, 298, 37, 148, 25, 398,
47, 98, 29, 198, 8, 373, 31, 28, 19, 373, 31, 398, 47, 398,
47, 298, 37, 323, 29, 298, 37, 298, 37, 398, 47, 348, 33,
298, 37, 48, 19, 398, 47, 273, 12, 98, 29, 298, 37, 323,
29, 298, 37, 28, 19, 348, 33, 398, 47, 48, 19, 13, 12, 148,
25, 28, 19, 298, 37, 73, 27, 398, 47, 148, 25, 423, 10, 373,
31, 298, 37, 373, 31, 448, 52, 373, 31, 323, 29, 398, 47,
198, 8, 13, 12, 323, 29, 148, 25, 298, 37, 348, 33, 298,
37, 73, 27, 423, 10, 73, 27, 48, 19, 373, 31, 98, 29, 98,
29, 48, 19, 273, 12, 398, 47, 13, 12, 373, 31, 298, 37, 448,
52, 98, 29, 28, 19, 323, 29, 398, 47, 98, 29, 28, 19, 448,
52, 223, 4, 448, 52, 348, 33, 148, 25, 398, 47, 123, 18,
298, 37, 5, 7, 48, 19, 448, 52, 448, 52, 148, 25, 398, 47,
5, 7, 298, 37, 48, 19, 298, 37, 398, 47, 48, 19, 73, 27,
98, 29, 448, 52, 13, 12, 148, 25, 398, 47, 398, 47, 323,
29, 123, 18, 373, 31, 448, 52, 148, 25, 73, 27, 348, 33,
273, 12, 248, 2, 348, 33, 373, 31, 448, 52, 173, 8, 48, 19,
298, 37, 323, 29, 448, 52, 73, 27, 398, 47, 48, 19, 348,
33, 13, 12, 98, 29, 123, 18, 28, 19, 273, 12, 273, 12, 448,
52, 398, 47, 373, 31, 298, 37, 398, 47, 248, 2, 123, 18,
448, 52, 48, 19, 273, 12, 98, 29, 73, 27, 98, 29, 448, 52,
448, 52, 298, 37, 98, 29, 73, 27, 48, 19, 13, 12, 373, 31,
173, 8, 323, 29, 348, 33, 398, 47, 348, 33, 48, 19, 98, 29,
273, 12, 373, 31, 148, 25, 373, 31, 123, 18, 73, 27, 323,
29, 5, 7, 98, 29, 48, 19, 448, 52, 73, 27, 28, 19, 98, 29,
448, 52, 273, 12, 148, 25, 398, 47, 48, 19, 123, 18, 73,
27, 98, 29, 348, 33, 398, 47, 448, 52, 448, 52, 448, 52,
98, 29, 273, 12, 73, 27, 348, 33, 373, 31, 98, 29, 273, 12,
148, 25, 323, 29, 98, 29, 48, 19, 148, 25, 273, 12, 28, 19,
98, 29, 448, 52, 398, 47, 98, 29, 273, 12, 298, 37, 223,
4, 148, 25, 123, 18, 48, 19, 348, 33, 348, 33, 373, 31, 5,
7, 73, 27, 373, 31, 73, 27, 448, 52, 448, 52, 48, 19, 98,
29, 323, 29, 123, 18, 398, 47, 373, 31, 373, 31, 28, 19,
73, 27, 398, 47, 348, 33, 398, 47, 398, 47, 448, 52, 98,
29, 348, 33, 13, 12, 148, 25, 448, 52, 348, 33, 98, 29, 148,
25, 28, 19, 323, 29, 348, 33, 423, 10, 348, 33, 398, 47,
73, 27, 373, 31, 48, 19, 98, 29, 348, 33, 98, 29, 448, 52,
373, 31, 123, 18, 123, 18, 13, 12, 398, 47, 398, 47, 448,
52, 123, 18, 348, 33, 13, 12, 323, 29, 448, 52, 323, 29,
48, 19, 73, 27, 348, 33, 98, 29, 423, 10, 28, 19, 398, 47,
98, 29, 123, 18, 398, 47, 448, 52, 373, 31, 398, 47, 98,
29, 173, 8)), row.names = c(NA, -858L), class = "data.frame")
library(ggplot2)
library(dplyr)
library(plotly)
p <-
ggplot(Tar, aes(x = Week, y = Count, fill = Type))
geom_area(alpha = 0.6 , size = 0.5, colour = "white", stat = "identity", orientation = "x")
labs(fill = NULL)
theme(legend.position = "bottom")
p <- p labs(title = "Figure 1: Weekly Cumulative Projected Enrollment vs Weekly Cumulative Actual Enrollment",
subtitle = "Cum Weekly Projected Enrollment/Cum Weekly Actual Enrollment")
# not printed
ggplotly(p)
This is how it should look like:
CodePudding user response:
You have duplicate entries for each group and week in your data, hence the messy look. Additionally, to not stack current and cumulative, which is quite misleading, you can set position = "identity"
. And I brought the actual values to the front via the factor transformation but handle this as you like.
library(ggplot2)
library(dplyr)
library(plotly)
clean_data <- Tar %>%
distinct() %>%
mutate(Type = ordered(Type, levels = unique(Type)[2:1]))
p <- ggplot(clean_data, aes(x = Week, y = Count, fill = Type, group = Type))
geom_area(alpha = 0.6 , size = 0.5, colour = "white", position = "identity", orientation = "x")
labs(fill = NULL)
theme(legend.position = "bottom")
p <- p labs(title = "Figure 1: Weekly Cumulative Projected Enrollment vs Weekly Cumulative Actual Enrollment",
subtitle = "Cum Weekly Projected Enrollment/Cum Weekly Actual Enrollment")
p
# not printed
ggplotly(p)
CodePudding user response:
Old answer:
library(tidyverse)
library(plotly)
p <- Tar %>%
group_by(Week, Type) %>%
summarise(mean_count = mean(Count)) %>%
mutate(Type = factor(Type, levels = rev(unique(Type)))) %>%
ggplot(aes(x = Week,
y = mean_count,
fill = Type))
geom_area(alpha = 0.6 ,
size = 0.5,
colour = "white",
orientation = "x")
theme(legend.position = "bottom",
legend.title = element_blank())
p <- p
labs(title = "Figure 1: Weekly Cumulative Projected Enrollment vs Weekly Cumulative Actual Enrollment",
subtitle = "Cum Weekly Projected Enrollment/Cum Weekly Actual Enrollment")
p
Please note that you have a typo on your data: you wrote Cumilative and not
Cumulative
.