Open DasHammett opened 1 year ago
I might have solved the issue.
maps_height <- ggmap(topo, darken = c(1,"white")) +
geom_sf(data = mapa,
aes(fill = pc_vots),
inherit.aes = FALSE,
# color = "grey20",
lwd = 0.1
) +
theme_void() +
theme(legend.position = "none")
I have used the darken
option from ggmap
to override the map with a pure white background. This is then interpreted by plot_gg
as 0 height.
There are still some minor artifacts at the edges of the plot that with the shadows are exaggerated
Is your feature request related to a problem? Please describe. I am trying to create a 3D map based on a
ggmap
object with ageom_sf()
layer into it, but the 3D render of the fill attribute is either not aligning or the render also computes heights for areas where there is nofill
argument.Here's the code I use (I am aware this is not a reprex)
I use 2 ggplot objects because I need to control the color of the
fill
in thegeom_sf
(that would be themap
object), and then I provide another ggplot object with the height (maps_height
).When plotting this combination with the instruction above, I get this result:
As you can see in the bottom part, the heights are not aligned with the boundaries of the
geom_sf
. It looks like themaps_height
needs to be scaled up a bit. Perhaps this is because I am not using the topografic map fromggmap
but an emptyggplot
and the scales are different.Now if I force the
maps_height
to be built with the topografic layer as well with:I get this result:
Where you can see a mess of lines emerging from the topografic layer that has no
fill
attributeDescribe the solution you'd like I would like either an automatic scale of geoms shared if multiple ggplot objects are passed or not consider the topografic layer for the 3D height, sepecially when there is no
fill
argument. BUT the alignment of thegeom_sf
is correctDescribe alternatives you've considered I have looked how I can scale up/down the
ggplot
objects to make sure they are the same size, but have failed to do so.Additional context Creating a 3D plot only using the
geom_sf
layer, works beautifully and have no issues whatsoever