这是indexloc提供的服务,不要输入任何密码
Skip to content

tm_inset with tmap object doesn't work #1171

@jgires

Description

@jgires

Hi,
Thank you very much for all your work on this wonderful package !

I have a problem : I'm trying to put an inset map in the main map with tm_inset(), but it doesn't work.
So to understand I tried the example on the documentation :

NLD_muni$pop_est_dens = NLD_muni$population / NLD_muni$area

tm_NLD = tm_shape(NLD_muni) +
    tm_polygons(fill = "pop_est_dens", 
                fill.legend = tm_legend_hide(),
                fill.scale = tm_scale_continuous_sqrt(values = "viridis", limits = c(0, 6500)),
                col = NULL) +
    tm_shape(NLD_prov) +
    tm_borders()

tm_shape(World) +
    tm_polygons(fill = "pop_est_dens", 
                col = "black",
                fill.scale = tm_scale_continuous_sqrt(values = "viridis", limits = c(0, 6500))) +
    tm_inset(tm_NLD, position = c("left", "bottom")) +
    tm_crs("+proj=robin")

But I have the same error :

Error in UseMethod("tmapGridCompPrepare") : 
no applicable method for 'tmapGridCompPrepare' applied to an object of class "c('tm_inset_tmap', 'tm_inset', 'tm_component', 'tm_element', 'list')"

My config : Windows 10, with R 4.4.1 and the last version of tmap (4.1).

Do I miss something or is there a problem somewhere ?

Thanks a lot !

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions