sebastianbarfort / mapDK

R package for making maps of Denmark
49 stars 5 forks source link

Interval in mapDK #25

Closed tobiasrasmusson closed 7 years ago

tobiasrasmusson commented 7 years ago

Hi.

Is it possible to split up the scale in intervals in the package or is it the only option to have continuing scale?

I also have some troubles changing colors og the scale. How can I do that?

Tobias

epetrovski commented 7 years ago

If you recode your "values" variable to a factor variable, the map should automatically use the factor levels to assign colors to the map.

To change these colors, use something like this: mapDK(...) + scale_fill_brewer(palette = "Blues", name="Name", na.value="grey50")

You can set the palette to something else than "Blues" if you want or use scale_fill_manual if you want to define your own colors.

emilBeBri commented 7 years ago

Tobias, your questions does not have anything to do with this package: You need to learn how to use ggplot2, the package which this package utilizes. And get a general knowledge about how to recode variables in R.

You should check out this book by Hadley Wickham, which is available online for free here:

http://r4ds.had.co.nz/

sebastianbarfort commented 7 years ago

Hi @tobiasrasmusson,

What @epetrovski writes is correct. mapDK returns a ggplot object which you can modify as you would any other ggplot object. I'm sorry this was not clear, the package is currently not very well documented. Hope you were able to solve your problem.