Error in map creation in biscale package

Hi, I've just installed the biscale package to make a bivariate map of crime rate and deprivation. I am new to R so I apologise if the formatting is wrong. This is the code I used:

bimap <- bi_class(LSOA, x = IMD_RANK, y = lograte, style = "quantile", dim = 3)
map2 <- ggplot() +
  geom_sf(data = LSOA, mapping = aes(fill = bimap), color = "white", size = 0.1, show.legend = FALSE) +
  bi_scale_fill(pal = "DkBlue", dim = 3) +
  labs(
    title = "Crime rate and deprivation in London",
    subtitle = "Dark Blue (DkBlue) Palette"
  ) +
  bi_theme()

And this is the error I received:

Error: Aesthetics must be either length 1 or the same as the data (4835): fill

Does anyone know how I would go about fixing this? Thanks!

Hi, welcome to the forum

I have never used biscale but it looks to me as if we will need some sample data to go with the code that you supplied--thanks BTW. A handy way to supply sample data is to use the dput() function. See ?dput. If you have a very large data set then something like head(dput(myfile), 100) will likely supply enough data for us to work with.

For general advice on asking questions here have a look at

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.