Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

using 'custom' colors? #53

Closed
jeffcsauer opened this issue Mar 29, 2019 · 1 comment
Closed

using 'custom' colors? #53

jeffcsauer opened this issue Mar 29, 2019 · 1 comment

Comments

@jeffcsauer
Copy link

Hello again!

Quick question! Is it possible to use custom color gradients?

For example, is it possible to set the lowest value as "white" and highest value as "dodgerblue4"?

I saw the post about using hex colors but did not have luck...

@rCarto
Copy link
Member

rCarto commented Mar 29, 2019

This is not particularly related to cartography, which uses whatever colors you give it.
Anyway, I would probably use colorRampPalette().

library(cartography)
library(sf)
#> Linking to GEOS 3.5.1, GDAL 2.2.3, PROJ 4.9.3
mtq <- st_read(system.file("gpkg/mtq.gpkg", package="cartography"), quiet = T)

cols <- colorRampPalette(colors = c("white", "dodgerblue4"))(6)

choroLayer(x = mtq, var = "MED", nclass=6, method = "quantile", col = cols)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants