Skip to contents

Map component that adds a logo.

Usage

tm_logo(
  file,
  height,
  margins,
  between_margin,
  stack,
  position,
  frame,
  frame.lwd,
  frame.r,
  group.frame,
  resize_as_group,
  z
)

Arguments

file

either a filename or url of a png image. If multiple files/urls are provided with a character vector, the logos are placed near each other. To specify logos for small multiples use a list of character values/vectors. In order to stack logos vertically, multiple tm_logo elements can be stacked.

height

height of the logo in number of text line heights. The width is scaled based the height and the aspect ratio of the logo. If multiple logos are specified by a vector or list, the heights can be specified accordingly.

margins

margins

between_margin

Margin between

stack

stack with other map components, either "vertical" or "horizontal".

position

An object created with tm_pos_in() or tm_pos_out(). Or, as a shortcut, a vector of two values, specifying the x and y coordinates. The first is "left", "center" or "right" (or upper case, meaning tighter to the map frame), the second "top", "center" or "bottom". Numeric values are also supported, where 0, 0 means left bottom and 1, 1 right top. See also vignette about positioning.

frame

frame

frame.lwd

frame line width

frame.r

Radius of the rounded frame corners. 0 means no rounding.

group.frame

group.frame

resize_as_group

resize_as_group

z

z

Examples

data(World)

tm_shape(World) +
  tm_polygons("HPI", fill.scale = tm_scale_intervals(values = "brewer.rd_yl_gn")) +
  tm_logo(c("https://www.r-project.org/logo/Rlogo.png",
        system.file("help", "figures", "logo.png", package = "tmap"))) +
  tm_logo("http://blog.kulikulifoods.com/wp-content/uploads/2014/10/logo.png",
      height=5, position = c("left", "top")) +
  tm_format("World")
#> [deprecated] `tm_format("World")` is deprecated as of tmap 4.0. Instead, please
#> use `tm_layout(inner.margins=c(0, 0.05, 0.025, 0.01),
#> legend.position=tm_pos_in("left", "bottom"), component.position=c("right",
#> "bottom"), scale=.8, title.size = 1.3)`