I have used hexagons to mimic texture/pattern on a map drawn with ggplot. These hexagons are added as a sf object (intersection with the map sf object). This is working quite nicely, and I thought I would be able to use scale_shape_manual to create a legend with a white hexagon and a label.
But I can't get it to work. A very simple reprex follows, the map is irrelevant to the query so I've just plotted a line and then want to add a shape legend.
- I don't want the points to be visible having provided the hexagons elsewhere, but I think the geom_point might be required (colour = NA removes the shape from both the plot and the legend).
- I thought I could use the unicode horizontal hexagon character, '\u2B23', but it isn't rendering. Font issue? I can't see how I can specify a font for a shape, eg in theme().
library(tidyverse) DF <- tibble(x = c(1, 2), y = c(1, 2), z = 'a') ggplot(DF, aes(x = x, y = y, shape = z)) + geom_line() + # 'dummy' geom_point - I don't want the points, just to be # able to create a shape legend geom_point() + scale_shape_manual(values = '\u2B23', label = '<k', name = '')
Created on 2019-03-11 by the reprex package (v0.2.1)