I wonder why I the code below only works when I use 11 in the number of colors for hcl.colors function? Using other values caused an error must have one more break than colour.
If I’d like to represent the data in 4 class, for instance, what should I do? Would appreciate if someone could help me understand the reason.
dat1 <- rnaturalearth::ne_countries(returnclass = "sf", scale = 110)
plot(dat1["gdp_md_est"],
key.pos = 4,
axes = FALSE,
pal = hcl.colors(11, "Dark Mint", rev = TRUE),
key.width = lcm(1.3), key.length = 0.75
)
