I am trying to connect the geom_points in my ggplot with geom_path. The lines should be in the same color as the geom_point fill color. However, geom_path does not know fill and color is used for a different grouping.
I am also highlighting certain geom_points with black outline using
scale_color_manual(values = c("NA", "black"), labels = c("No Buy Box", "Buy Box"))
What can I do? In fact, I want to plot the dots in different color (fill) by seller_id, highlight certain of these dots with colour = black if bbox = 1 and in addition connect the dots in their color using geom_path. I assume there are some more general issues in how I layered up the graphs in terms of the sub-sampling. geom_path does not know fill, this would have been the easiest solution. A data snippet is at the end to this post.
Thank you!!
ggplot(data = subset(algo_pricing,bbox_product == 9200000096286280), aes(x = bbox_time2)) +
geom_point(mapping = aes(y = price_total, colour = as.factor(bbox), fill = seller_id), shape = 21) +
geom_line(data = subset(algo_pricing, bbox ==1 & bbox_product == 9200000096286280),
mapping = aes(y = bbox_price, linetype = as.factor(bbox)),colour = "black") +
geom_path(mapping = aes(y = price_total, colour = seller_id), linetype = "dotted") +
scale_linetype_manual(values = "dotted", labels = "Buy Box Price") +
scale_color_manual(values = c("NA", "black"), labels = c("No Buy Box", "Buy Box"))
example <- wrapr::build_frame(
"bbox_time2" , "bbox_price", "price_total", "seller_id" , "bbox", "min_price", "bbox_product" |
as.Date("2019-01-07"), 151 , 169.9 , "linkerlisse" , 0L , 129.5 , 4.641e-308 |
as.Date("2019-01-18"), 125 , 169.9 , "linkerlisse" , 0L , 112 , 4.641e-308 |
as.Date("2019-01-20"), 125 , 169.9 , "goedslapennl" , 0L , 118.5 , 4.641e-308 |
as.Date("2019-01-14"), 120 , 169.9 , "decoware" , 0L , 114.3 , 4.641e-308 |
as.Date("2019-01-18"), 125 , 169.9 , "goedslapennl" , 0L , 112 , 4.641e-308 |
as.Date("2019-01-19"), 125 , 125 , "bol.com" , 1L , 125 , 4.641e-308 |
as.Date("2019-01-20"), 125 , 169.9 , "decoware" , 0L , 121 , 4.641e-308 |
as.Date("2019-01-19"), 125 , 169.9 , "decoware" , 0L , 124.2 , 4.641e-308 |
as.Date("2019-01-10"), 135 , 120.3 , "hetbestebeddengoed.nl", 0L , 120.3 , 4.641e-308 |
as.Date("2019-01-11"), 135 , 135 , "bol.com" , 1L , 115.5 , 4.641e-308 |
as.Date("2018-12-31"), 151 , 151 , "bol.com" , 1L , 143.8 , 4.641e-308 |
as.Date("2019-01-17"), 125 , 169.9 , "goedslapennl" , 0L , 116.2 , 4.641e-308 |
as.Date("2019-01-20"), 125 , 169.9 , "goedslapennl" , 0L , 119.8 , 4.641e-308 |
as.Date("2019-01-17"), 125 , 169.9 , "goedslapennl" , 0L , 115.5 , 4.641e-308 |
as.Date("2019-01-22"), 112.3 , 112.3 , "hetbestebeddengoed.nl", 1L , 112.3 , 4.641e-308 |
as.Date("2019-01-01"), 151 , 169.9 , "linkerlisse" , 0L , 142.1 , 4.641e-308 |
as.Date("2019-01-21"), 125 , 127.5 , "sleepworld" , 0L , 117.8 , 4.641e-308 |
as.Date("2018-12-31"), 151 , 151 , "bol.com" , 1L , 142.8 , 4.641e-308 |
as.Date("2019-01-18"), 125 , 169.9 , "smulderstextiel.nl" , 0L , 125 , 4.641e-308 |
as.Date("2019-01-01"), 151 , 169.9 , "linkerlisse" , 0L , 141.2 , 4.641e-308 )