get_palette {cartographr}R Documentation

Create a palette for maps

Description

This function creates a color theme to be used with plot_map(). It can accept a predefined palette name or a custom palette provided as a named list.

Usage

get_palette(palette)

Arguments

palette

The color palette to use. Can be one of "alphabet", "arctic", "autumn", "autumn-muted", "bw", "desert", "evening", "gray", "iberia", "imhof", "lines", "metropolitan", "midnight", "minimal", "swiss", "tropical", or a named list for a custom palette. If a named list is provided, it should contain color hex codes for each map element. If NULL or an unrecognized name is provided, the function will throw an error.

Details

The color moods for the predefined palettes are described as follows:

In addition, you can customize other settings:

These settings allow for a high degree of customization when creating maps, providing users with the ability to fine-tune the appearance of their map elements according to their specific needs or preferences.

Value

A list containing color settings for the map elements.

Examples

# Use predefined palette
get_palette("imhof")

# Custom palette creation using a named list for a simple black and white palette
custom_palette <- list(
  palette_building = c("#000000", "#FFFFFF", "#CCCCCC"),
  water = "#000000",
  green = "#FFFFFF",
  beach = "#000000",
  parking = "#FFFFFF",
  street = "#000000",
  background = "#CCCCCC",
  railway = "#000000",
  hatch_water = TRUE,
  linewidth_buildings = 0.05,
  linewidth_motorway = 6,
  linewidth_primary = 4,
  linewidth_secondary = 4,
  linewidth_tertiary=3,
  linewidth_unclassified = 3,
  linewidth_residential = 3,
  linewidth_pedestrian = 1,
  linewidth_service = 1,
  linewidth_living_street = 1,
  size_hatch = 1,
  alpha_hatch = 0.1,
  size_streetlamp = 0.2
)

get_palette(custom_palette)

[Package cartographr version 0.2.2 Index]