Closed jdsher closed 3 years ago
Thank you for the report - it is an oversight on my part. geom_sf()
returns a list instead of a layer and I didn't plan for that
I hope it is not impolite to comment on a closed issue :hand_over_mouth:
Yet, I wanted to give a quick heads up since I regularly use {ggfx} with geom_sf()
and it works just fine.
I simply catch the first element of said returned list - like so:
library(rnaturalearth)
library(sf)
library(ggfx)
library(ggplot2)
canada <- ne_states(country = "Canada", returnclass = "sf")
canada_inset <- st_buffer(canada, -.7)
ggplot() +
as_reference(
geom_sf(data = canada_inset)[[1]],
id = 'inset' ) +
geom_sf(data = canada) +
with_blend(
with_blur( geom_sf(data = canada_inset,
size = 3,
color = rgb(0,0,0,.4),
fill = "transparent")[[1]],
sigma = 3),
bg_layer = 'inset',
blend_type = 'in') +
coord_sf(crs = 3347)
(link to the plot on imgur - I believe it is not displayed on github...)
Created on 2021-04-08 by the reprex package (v2.0.0)
Not impolite at all. However, the release version of ggfx handles geom_sf()
just fine so there is no need to jump through any hoops to get it working🙂
awesome - I missed that update :+1: :star_struck:
Very possible I've missed some key understanding, but at first pass it appears that some functions, specifically
as_reference()
andwith_shadow()
do not work withsf
objects/geom_sf()
. Looks to be some incompatibility with sf's geometry list columns? I keep gettingError in UseMethod("with_shadow") : no applicable method for 'with_shadow' applied to an object of class "list"
Reprex: