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

attempt to create faceted plot involving raster and vector fails #415

@lbusett

Description

@lbusett

Hi,

on tmap 3.0, trying to create a faceted plot involving both raster and vector datasets with the same number of "facets" is currently failing, as in:

library(dplyr)
library(stars)
library(tmap)

s = stars::read_stars(system.file("tif/L7_ETMs.tif", package = "stars"))%>% 
  stars::st_warp(crs = 3857)
v = sf::st_as_sf(sf::st_as_sfc(sf::st_bbox(s)))
v = rbind(v,v,v,v,v,v)
v$band = 1:6                 

tmap_mode("plot")
rast <- tm_shape(s) + tm_raster() + tm_facets()
vect <- tm_shape(v) + tm_borders() + tm_facets("band")
rast 
# renders ok
vect
# renders ok
rast + vect

Fails with:

Error in by_counts_pos[-1] != by_counts_pos[1] :
comparison of these types is not implemented

(Sorry for the missing pictures, but reprex does not want to work, this morning...)

HTH,

Lorenzo

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