koenderks/rcityviews

Control Over Text Size

Closed this issue · 2 comments

Is your feature request related to a problem? Please describe.
In making the following map, I noticed the names seem inappropriately large, causing overlap and distraction from the map itself.

myTheme <- list(
  colors = list(
    background = "#232323",
    water = NA,
    landuse = NA,
    contours = NA,
    streets = "#FF8200",
    rails = c("#FF8200", "#232323"),
    buildings = NA,
    text = "#ffffff",
    waterlines = NA
  ),
  font = list(
    family = "serif",
    face = "bold",
    append = "\u2014"
  ),
  size = list(
    borders = list(
      contours = 0.3,
      water = 0.4,
      canal = 0.5,
      river = 0.6
    ),
    streets = list(
      path = 0.2,
      residential = 0.4,
      structure = 0.5,
      tertiary = 0.7,
      secondary = 0.8,
      primary = 0.9,
      motorway = 1,
      rails = 0.75,
      runway = 3
    )
  )
)
cityview(name = "Knoxville", zoom = 0.5, theme = myTheme)

image

Describe the solution you'd like
Do we have control over the country, city, long/lat, and attribution size and font?

Thanks, I will look into this! You have control over the font using myTheme[["family"]] and myTheme[["face"]], but currently not over the text size. As a quick temporary fix: The size of the text that you see depends on the dimensions of the exported figure and the quality (dpi). The map can be saved/exported in the recommended size and quality by calling:

ggplot2::ggsave(filename = "plot.png", plot = p, height = 500, width = 500, units = "mm", dpi = 100)

Or by providing cityview() with a filename directly, as is shown in the readme, like so:

myTheme <- list(
  colors = list(
    background = "#232323",
    water = NA,
    landuse = NA,
    contours = NA,
    streets = "#FF8200",
    rails = c("#FF8200", "#232323"),
    buildings = NA,
    text = "#ffffff",
    waterlines = NA
  ),
  font = list(
    family = "serif",
    face = "bold",
    append = "\u2014"
  ),
  size = list(
    borders = list(
      contours = 0.3,
      water = 0.4,
      canal = 0.5,
      river = 0.6
    ),
    streets = list(
      path = 0.2,
      residential = 0.4,
      structure = 0.5,
      tertiary = 0.7,
      secondary = 0.8,
      primary = 0.9,
      motorway = 1,
      rails = 0.75,
      runway = 3
    )
  )
)
cityview(name = "Knoxville", zoom = 0.5, theme = myTheme, filename = "plot.png")

This code gives:

hoi

You can now use myTheme[["font"]][["scale"]] to set the scaling factor for the font. Below is an example with scale = 0.5.

myTheme <- list(
  colors = list(
    background = "#232323",
    water = NA,
    landuse = NA,
    contours = NA,
    streets = "#FF8200",
    rails = c("#FF8200", "#232323"),
    buildings = NA,
    text = "#ffffff",
    waterlines = NA
  ),
  font = list(
    family = "serif",
    face = "bold",
    scale = 0.5,
    append = "\u2014"
  ),
  size = list(
    borders = list(
      contours = 0.3,
      water = 0.4,
      canal = 0.5,
      river = 0.6
    ),
    streets = list(
      path = 0.2,
      residential = 0.4,
      structure = 0.5,
      tertiary = 0.7,
      secondary = 0.8,
      primary = 0.9,
      motorway = 1,
      rails = 0.75,
      runway = 3
    )
  )
)
cityview(name = "Knoxville", zoom = 0.5, theme = myTheme, filename = "plot.png")

plot

Hope that helps!