Skip to content

criar hexsticker #8

@rafapereirabr

Description

@rafapereirabr

Seria legar o pacote ter um hexsticker. Aqui uma proposta bem inicial repdoduzível com código. A ideia é algo simples (mais minimalista) mas que ao mesmo tempo remeta às palavras-chave 'dados' e 'diversidade' do Brasil.

library(geobr)
library(ggplot2)
library(sf)
library(showtext)

# font_add("Frutiger",
#          regular = "C:/Users/user/Downloads/frutiger_ssv/frutiger_ssv/Frutiger LT Std 55 Roman Regular.otf",
#          bold = "C:/Users/user/Downloads/frutiger_ssv/frutiger_ssv/Frutiger LT Std 55 Roman Bold.otf")


# download Brazil map
b <- geobr::read_state()


set.seed(19)

## Data points
number <- 400

  # locations
  p <- st_sample(b, size=number, type = "random")

  # size
  s <- sample(.01:2, size=number, replace = T)
  s <- sample(seq(.01, 1, 0.1), size=number, replace = T)

  # color
  colors <- c('#2D3E50', '#ed6663', '#ffa372', '#ffc93c' , '#5eaaa8') # azul claro '#4e89ae'
  col_vec <- sample(colors, size=number, replace = T)

  
## plot
plot <-
  ggplot() +
  geom_sf(data=p, size=s, color=col_vec, fill=col_vec, alpha=.6) +
  theme_void() +
  theme_transparent()

## save
sticker(plot,
        package="ipeaData", p_color="#2D3E50", p_size=20, p_y = 1.5, p_family ="Frutiger",
        s_x=1, s_y=.8, s_width=1.4, s_height=1.4, # ggplot image size and position
        h_fill="gray99", h_color="#2D3E50", h_size=1.5, # hexagon
        filename=paste0("C:/Users/user/Desktop/ipeaData_logo.png"), dpi=300)  # output name and resolution

ipeaData_logo

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions