I have a geom_point ggplot and I'm trying to employ custom backgrounds and colors (text). I've written a couple of simple function to set the background and color. Here is my plot code.
p<-ggplot(tchart, aes(x = beatenLengths,y = OffRail)) + geom_point() + geom_label(aes(label=pgm, fill=map(pgm,pgmcolorb), color=map(pgm,pgmcolor)), size = 2.5) + geom_convexhull(alpha = 0.2, fill = "blue") + facet_wrap(~ Sixteenth, ncol=4) + theme_fivethirtyeight() p
When I run this code a get the following errors numerous times. The chart is ultimately rendered, but there is no text and the labels are distorted. See below.
Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
supplied color is neither numeric nor character
Warning in grid.Call.graphics(C_setviewport, vp, TRUE): supplied color is
neither numeric nor character
Alternatively, if I run the code with the geom_label below the chart works, but I have no custom colors - I need custom colors.
geom_label(aes(label=pgm, fill=map(pgm,pgmcolorb)), size = 2.5, color="white") +
How can I structure my geom_label to get both custom backgrounds and colors?