1

I am experiencing strange behavior of ggplot2 chart. After removing title of Y axis chart changes it changes. Did anyone experienced anything similar? It seems that it might be affected because of narrower axis after adding axis name, but still in my data highest value when colum1 is 0 is more than 400 and after decreasing chart, you cannot see this spike at column1 value 0. Is it normal behavior of this type of chart?

structure(list(place = c("y", "y", "y", "y", "y", "y", "y", "y", 
"y", "y", "y", "y", "y", "y", "y", "y", "y", "y", "y", "y", "y", 
"y", "y", "y", "y", "y", "y", "y", "y", "y", "y", "y", "y", "y", 
"y", "y", "y", "y", "y", "y", "y", "y", "y", "y", "y", "y", "y", 
"y", "y", "y", "y", "y", "y", "y", "y", "y", "y", "y", "y", "y", 
"y", "y", "y", "y", "y", "y", "y", "y", "y", "y", "y", "y", "y", 
"y", "y", "y", "y", "y", "y", "y", "y", "y", "y", "y", "y", "y", 
"y", "y", "y", "y", "y", "y", "y", "y", "y", "y", "y", "y", "y", 
"y", "y", "y", "y", "y", "y", "y", "y", "y", "y", "y", "y", "y", 
"y", "y", "y", "y", "y", "y", "y", "y", "y", "y", "y", "y", "y", 
"y", "y", "y", "y", "y", "y", "y", "y", "y", "y", "y", "y", "y", 
"y", "y", "y", "y", "y", "y", "y", "y", "y", "y", "y", "y", "y", 
"y", "y", "y", "y", "y", "y", "y", "y", "y", "y", "y", "y", "y", 
"y", "y", "y", "y", "y", "y", "y", "y", "y", "y", "y", "y", "y", 
"y", "y", "y", "y", "y", "y", "y", "y", "y", "y", "y", "y", "y", 
"y", "y", "y", "y", "y", "y", "y", "y", "y", "y", "y", "y", "y", 
"y", "y", "y", "y", "y", "y", "y", "y", "y", "y", "y", "y", "y", 
"y", "y", "y", "y", "y", "y", "y", "y", "y", "y", "y", "y", "y", 
"y", "y", "y", "y", "y", "y", "y", "y", "y", "y", "y", "y", "y", 
"y", "y", "y", "y", "y", "y", "y", "y", "y", "y", "y", "y", "y", 
"y", "y", "y", "y", "y", "y", "y", "y", "y", "y", "y", "y", "y", 
"y", "y", "y", "y", "y", "y", "y", "y", "y", "y", "y", "y", "y", 
"y", "y", "y", "y"), column1 = c(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 
10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 
26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 
42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 
58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 
74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 
90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 
105, 106, 107, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 
119, 120, 122, 123, 124, 126, 127, 131, 132, 133, 134, 135, 136, 
137, 138, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 
151, 152, 153, 155, 156, 157, 158, 159, 160, 161, 164, 165, 166, 
168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 
181, 183, 184, 187, 190, 191, 192, 193, 194, 196, 197, 200, 201, 
202, 203, 204, 205, 206, 208, 209, 210, 212, 213, 214, 215, 217, 
218, 220, 222, 224, 225, 226, 228, 229, 231, 232, 233, 234, 235, 
236, 237, 238, 239, 241, 243, 247, 248, 249, 255, 256, 257, 259, 
261, 263, 267, 268, 269, 272, 273, 274, 275, 277, 278, 279, 280, 
281, 282, 283, 287, 288, 289, 291, 293, 294, 295, 297, 299, 302, 
304, 307, 308, 310, 313, 315, 316, 318, 319, 320, 321, 322, 323, 
324, 325, 326, 327, 329, 330, 333, 334, 338, 339, 341, 343, 344, 
347, 348, 349, 350, 352, 353, 354, 355, 360, 363, 364), column2 = c(418, 
12, 3, 3, 16, 6, 3, 6, 5, 3, 2, 2, 5, 7, 13, 9, 2, 5, 15, 18, 
59, 15, 11, 7, 19, 13, 10, 24, 23, 20, 57, 10, 8, 8, 22, 13, 
14, 3, 26, 13, 8, 7, 10, 6, 5, 14, 17, 12, 28, 15, 17, 9, 6, 
10, 9, 6, 17, 9, 7, 3, 10, 9, 4, 6, 3, 12, 5, 3, 6, 7, 4, 4, 
2, 10, 2, 3, 8, 5, 8, 36, 6, 11, 4, 10, 7, 7, 11, 7, 8, 8, 1, 
5, 3, 1, 2, 7, 2, 5, 3, 1, 1, 2, 5, 1, 4, 7, 2, 5, 4, 5, 8, 10, 
2, 1, 2, 2, 2, 5, 7, 1, 4, 4, 1, 12, 3, 4, 2, 1, 18, 2, 1, 2, 
3, 10, 1, 6, 2, 2, 6, 1, 5, 2, 3, 2, 1, 6, 3, 2, 1, 8, 1, 1, 
2, 1, 3, 4, 4, 3, 2, 1, 3, 4, 2, 3, 2, 2, 1, 4, 3, 3, 4, 1, 2, 
4, 2, 2, 2, 1, 3, 11, 4, 3, 3, 1, 1, 1, 2, 1, 2, 1, 6, 6, 2, 
1, 1, 2, 4, 1, 1, 2, 3, 14, 1, 2, 2, 4, 3, 1, 1, 1, 2, 1, 2, 
2, 1, 3, 6, 3, 1, 1, 4, 7, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, 2, 
2, 4, 2, 1, 3, 3, 1, 1, 2, 1, 1, 1, 1, 2, 1, 4, 2, 1, 1, 2, 3, 
3, 2, 2, 2, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 6, 3, 1, 3, 1, 2, 2, 
1, 4, 3, 1, 4, 1, 2, 2, 1)), class = c("tbl_df", "tbl", "data.frame"
), row.names = c(NA, -285L), spec = structure(list(cols = list(
    place = structure(list(), class = c("collector_character", 
    "collector")), column1 = structure(list(), class = c("collector_double", 
    "collector")), column2 = structure(list(), class = c("collector_double", 
    "collector"))), default = structure(list(), class = c("collector_guess", 
"collector")), skip = 1), class = "col_spec"))

CHART NO.1:

    test_Copy %>% 
  filter(place == "y") %>%
  ggplot(aes(column1, column2)) +
  geom_area() +
  theme(axis.title = element_blank()) +
  facet_grid(~place)

CHART NO.2:

    test_Copy %>% 
  filter(place == "y") %>%
  ggplot(aes(column1, column2)) +
  geom_area() +
  facet_grid(~place)

Increased chart: enter image description here

Decreased chart: enter image description here

  • 1
    Hi, could you provide a reproducible example? Try using `dput(usage)` and copy paste the output. This will help everybody on answering your question since we are able to recreate your issue! – Stan Feb 14 '19 at 15:41
  • You can use the [`reprex`](https://reprex.tidyverse.org/articles/articles/magic-reprex.html) and [`datapasta`](https://cran.r-project.org/web/packages/datapasta/vignettes/how-to-datapasta.html) packages to quickly create a reproducible example so others can help. Please do not use `str()`, `head()` or screenshot. See also [Help me Help you](https://speakerdeck.com/jennybc/reprex-help-me-help-you?slide=5) & [How to make a great R reproducible example?](https://stackoverflow.com/q/5963269) – Tung Feb 14 '19 at 19:01
  • Hi, I've added using dput(). – Giedrius Urbonas Feb 15 '19 at 07:36

0 Answers0