This post is an extension from this one
I want to know if I can use the ggtextures and ggplot packages to have two images side by side on a bar graph.
I've used ggtextures to have one image per bar, and it looks like this so far:
What I'm trying to do now is to add the NBA team logo next to the rookie pictures. The code for the graph below is something like this:
a5 %>%
ggplot(aes(x = reorder(Player,
PER),
y = PER,
fill = Player,
image = c(image))) +
geom_bar(stat = "identity") +
geom_isotype_col(
img_height = grid::unit(1, "null"), img_width = NULL,
ncol = 1, nrow = 1, hjust = 1, vjust = 0.5
) +
coord_flip() +
theme_minimal() +
xlab("Player") +
ylab(PER) +
theme(legend.position = "none")
I have an image column in my data to correspond to the rookie picture, and I also have another column to correspond to the team the rookie plays in. Is there any way I can change
image = c(image)))
to something like c(image, NBAteams), and get it to work with the line,
geom_isotype_col(
img_height = grid::unit(1, "null"), img_width = NULL,
ncol = 1, nrow = 1, hjust = 1, vjust = 0.5
)
?