eliocamp / metR

Tools for Easier Analysis of Meteorological Fields
https://eliocamp.github.io/metR/
143 stars 22 forks source link

the background of the arrow legend turns black #189

Closed PanfengZhang closed 7 months ago

PanfengZhang commented 7 months ago

When drawing wind vector and other elements at the same time, the background of the arrow legend turns black, and the arrows also turn white.

library(ggplot2)
library(metR)

set.seed(1)
xmin <- 90
xmax <- 150
ymin <- 10
ymax <- 50
dd <- expand.grid(lon = seq(xmin, xmax, by = 2),
                  lat = seq(ymin, ymax, by = 2))
ngrd <- nrow(dd)
dd[, "u"]   <- runif(ngrd, min = 0, max = 50)
dd[, "v"]   <- runif(ngrd, min = 0, max = 50)
dd[, "tem"] <- runif(ngrd, min = 0, max = 10)
head(dd)

ggplot(data = dd, aes(x = lon, y = lat)) +
  geom_raster(aes(fill = tem)) +
  geom_vector(aes(dx = u, dy = v), size = 0.2) +
  scale_mag() +
  coord_sf(crs = 4326)

![Uploading test.png…]()

eliocamp commented 7 months ago

The new key glyph should've solved this. https://github.com/eliocamp/metR/issues/186