I am trying to build a dumbbell plot (geom_dumbbell) in ggplot. The plot builds fine, but when I try and add details around the point color and size the plot fails to inherit aes, spewing:
Error:
mappingmust be created byaes()
Here is the code to generate a reproducible example:
test <- data.frame(Scenario = rep(c("LC-HD", "HC-HD", "LC-LD", "HC-LD"), times = 2),  
           technology = c("P", "W", "P", "W", "P", "W", "P", "W"),
           country = paste("country", rep(seq(1, 4, by = 1), times = 2)), 
           low = runif(8, min = 1, max = 3), 
           high = runif(8, min = 4, max = 6))
The following code runs fine:
library(ggplot2)
library(ggalt)
ggplot(test, aes(x = low, xend = high, y = country, group = country)) + 
  geom_dumbbell(color="grey", 
                size = 1) + 
  facet_grid(technology ~ Scenario) +
  coord_flip() + 
  theme(axis.text.x = element_text(angle = 90)) 
However when I make the below changes to the geom_dumbbell layer (setting point colours and sizes):
library(devtools)
library(ggplot2)
library(ggalt)
ggplot(test, aes(x = low, xend = high, y = country, group = country)) + 
  geom_dumbbell(color="grey", 
                size = 1, 
                point.size.l = 1.5, point.size.r = 1,5, 
                point.colour.l = "#58d9ef", point.colour.r = "#a3c4dc") +
  facet_grid(technology ~ Scenario) +
  coord_flip() + 
  theme(axis.text.x = element_text(angle = 90))
I get the error:
Error:
mappingmust be created byaes()
Even if i try set inherit.aes = T, explicitly in the geom_bumbbell layer, i still get the error.
The problem seems to be with the point.size argument as adding this gives the error. When i just add point.colour arguments, i get:
Warning: Ignoring unknown parameters: point.color.l, point.color.r
This is strange as these are parameters described in the documentation: https://www.rdocumentation.org/packages/SciencesPo/versions/1.4.1/topics/geom_dumbbell
I am running ggalt_0.6.1 (which loads geom_dumbbell)
What am i missing here. Why does adding details on the points change the way aes is inherited, and why aren't point.colour parameters recognized?
