Library(mapproj) data(unemp, package = "viridis") county_df <- map_data( "county", projection = "albers", parameters = c( 39, 45)) names(county_df) <- c( "long", "lat", "group", "order", "state_name", "county") county_df $state <- state.abb county_df $state_name <- NULL state_df <- map_data( "state", projection = "albers", parameters = c( 39, 45)) choropleth <- merge(county_df, unemp, by = c( "state", "county")) choropleth <- choropleth ggplot(choropleth, aes(long, lat, group = group)) + geom_polygon( aes( fill = rate), colour = alpha( "white", 1 / 2), linewidth = 0.2) + geom_polygon( data = state_df, colour = "white", fill = NA) + coord_fixed() + theme_minimal() + ggtitle( "US unemployment rate by county") + theme( axis.line = element_blank(), axis.text = element_blank(), axis.ticks = element_blank(), axis. The color map turbo was developed by Anton Mikhailov toĪddress the shortcomings of the Jet rainbow color map such as falseĭetail, banding and color blindness ambiguity. Originally created for the Seaborn statistical data Renslow, and originally ported to R by Marco The color map cividis is a corrected version of The science behind the creation of these color maps, you can watch this Inferno, and plasma were created by Stéfan vanĭer Walt ( and Nathaniel Smith ( If you want to know more about “plasma”, “inferno”, “civids”, “mako”, and “rocket” -, and a rainbow The package contains eight color scales: “viridis”, the primaryĬhoice, and five alternatives with similar properties - “magma”, Provides additional functionalities, in particular bindings for Lightweight and dependency-free as possible for maximum compatibility ViridisLite provides the base functions for generating In the call to the geom, inside of aes(), set the value. Properties hold true for people with common forms of colorblindness, as You want to use a variable (column from a data frame) to control the color of geoms. Robust to colorblindness, so that the above.Other have more different-appearing colors, consistently across the This can be either as bars of color or a palette or a pie chart. Perceptually uniform, meaning that values close toĮach other have similar-appearing colors and values far away from each.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |