ggplot(data = plot_2022points_ALL, aes(ScoringSystem, Rank)) +
ggbump::geom_bump(linewidth = 1.5,
mapping = aes(group=player_display_name,
color= I(team_color))) +
geom_point(aes(group=player_display_name, color=I(team_color2)),
size=4) +
geom_text(data = plot_2022points_ALL %>% filter(ScoringSystem == "ENOsysrank"),
aes(label=player_display_name,
color=position_group),
size = 4,
fontface = "bold",
nudge_x = -0.2,
hjust = 1)
When I pass this code it returns the error:
Error in `geom_text()`:
! Problem while converting geom to grob.
ℹ Error occurred in the 3rd layer.
Caused by error:
! Unknown colour name: QB
Everything else I have found online says to just put the color variable inside of aes()
but I have already done that.
Is this because other geoms use the I()
function for their color mappings? However, I would expect that the color mappings of other geoms would not affect the others...
Here is an example of what my data looks like:
position_group | player_display_name | team | points | ScoringSystem | Rank | team_color |
---|---|---|---|---|---|---|
QB | Patrick Mahomes | KC | 485.4 | ENOsysrank | 1 | #E31837 |
TE | Justin Jefferson | MIN | 378.7 | PPR | 6 | #4F2683 |
I tried putting the color aes into the ggplot()
function and deleting the color=
inside of the geom aes, but that didn't work.
Edit for clarity: I would like the geom_text to be colored according to position_group
whereas the other two geoms colored according to the hex values in team_color