I want this (left image), but instead of purple for the third fill option, I want it striped red & blue (right image).
Essentially, I want to merge these two codes:
State Code:
party_color <- c('red', 'blue', 'purple')
ggplot(data = id, mapping = aes(x = long, y = lat, group = group)) +
geom_polygon(data = id, aes(fill = party), color = "black") +
scale_fill_gradientn(colours = party_color) +
coord_map() +
theme_bw() +
theme(legend.position="none") +
ditch_the_axes
Stripe Code:
polygon_df <- dplyr::tibble(
angle = seq(0, 2*pi, length.out = 7) + pi/6,
x = cos(angle),
y = sin(angle)
)
ggplot(polygon_df) +
geom_polygon_pattern(
aes(x = x, y = y),
pattern = 'stripe',
fill = 'red',
pattern_fill = 'blue',
color = 'black'
) +
coord_equal() +
coord_map() +
theme_bw() +
How do I get the purple counties to be filled like the hexagon above? I need it to be a ggplot2 solution using geom_polygon. It doesn't necessarily have to be a ggpattern solution, but I like the look of the ggpattern, so that's why I am trying to use that, but all the examples I can find are for a single polygon, or using geom_map---not what I want to use.
Any state or country polygon example will work. I didn't include the "id" dataset because it is very large.
Thank you so much in advance!