@@ -63,3 +63,24 @@ test_that("paths with the same color but different groups stay together", {
63
63
64
64
save_outputs(gg , " path-colored-groups-stay-together" )
65
65
})
66
+
67
+ test_that(" lines work with aesthetic shape" , {
68
+ df1 <- data.frame (sex = factor (c(" Female" , " Female" , " Male" , " Male" )),
69
+ time = factor (c(" Lunch" , " Dinner" , " Lunch" , " Dinner" ),
70
+ levels = c(" Lunch" , " Dinner" )),
71
+ total_bill = c(13.53 , 16.81 , 16.24 , 17.42 ))
72
+ gg <- ggplot(data = df1 , aes(x = time , y = total_bill , group = sex , shape = sex )) +
73
+ geom_line() +
74
+ geom_point()
75
+ info <- gg2list(gg )
76
+ expect_equal(length(info ), 5 ) # 2 lines and 2 sets of points for each group
77
+ expect_identical(info [[3 ]]$ name , " Female" )
78
+ expect_identical(info [[3 ]]$ marker $ symbol , " circle" )
79
+ expect_identical(info [[4 ]]$ name , " Male" )
80
+ expect_identical(info [[4 ]]$ marker $ symbol , " triangle-up" )
81
+ # Layout
82
+ expect_identical(info [[5 ]]$ layout $ xaxis $ title , " time" )
83
+ expect_identical(info [[5 ]]$ layout $ xaxis $ type , " category" )
84
+
85
+ save_outputs(gg , " path-line-symbols" )
86
+ })
0 commit comments