@@ -39,6 +39,26 @@ test_that("legend vanishes when theme(legend.position = 'none'')", {
3939 expect_identical(info $ layout $ showlegend , FALSE )
4040})
4141
42+ test_that(" aesthetics can be discarded from legend with guide(aes = 'none')" , {
43+ df1 <- data.frame (
44+ Date = seq(as.Date(" 2021-01-01" ), as.Date(" 2021-01-10" ), " days" ),
45+ Series = c(rep(" SeriesA" , 10 ), rep(" SeriesB" , 10 )),
46+ Values = rnorm(n = 20 ),
47+ Mean = 0 , V1 = 2 , V2 = - 2
48+ )
49+
50+ p <- ggplot(df1 , aes(x = Date , y = Values , color = Series , linetype = Series , shape = Series )) +
51+ geom_line(aes(x = Date , y = Mean , color = " Mean" , linetype = " Mean" )) +
52+ geom_line(aes(x = Date , y = V1 , color = " QC" , linetype = " QC" )) +
53+ geom_line(aes(x = Date , y = V2 , color = " QC" , linetype = " QC" )) +
54+ geom_line() +
55+ geom_point() +
56+ guides(shape = " none" , linetype = " none" )
57+
58+ expect_doppelganger(p , " guide-aes-none" )
59+ })
60+
61+
4262p <- ggplot(mtcars , aes(x = mpg , y = wt , color = factor (vs ))) +
4363 geom_point()
4464
0 commit comments