Closed cpagniel closed 4 months ago
A simpler example that reproduces the same error as above (i.e., not white legend.key background):
library(ggspatial)
library(ggnewscale)
library(pals)
library(ggOceanMaps)
test <- data.frame(lon = c(-150:-120), lat = c(20:50), toppid = c(rep(c(10:15), each = 5),15))
basemap(limits = c(110, -110, 20, 60), rotate = TRUE,bathy.style = "rcb") +
new_scale_fill() +
geom_spatial_point(crs = 4326, data = test, aes(x = lon, y = lat, fill = factor(toppid)), size = 2, pch = 21, color = "black") +
scale_fill_manual(values = as.vector(alphabet(6))) +
theme(legend.key = element_rect(fill = "white", color = NA))
Nice that you found a solution and sorry for delayed reply. I was on a holiday.
I am trying to combine basemap from ggOceanMaps with geom_spatial_point and having the geom_spatial_point having a new color scale.
When I combine these two, the legend.key background color remains dark grey despite setting it to white in the theme. If I remove the basemap, there is no issues.
Any thoughts?
Here's the code (and image of plot):