IT博客汇
  • 首页
  • 精华
  • 技术
  • 设计
  • 资讯
  • 扯淡
  • 权利声明
  • 登录 注册

    India

    Michael发表于 2024-11-22 09:00:00
    love 0
    [This article was first published on r.iresmi.net, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
    Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

    A photo of Holi festivities in India

    Holi 2016-01 – CC-BY-NC-ND by Rajesh Pamnani

    Day 22 of 30DayMapChallenge: « 2 colours » (previously).

    Just a joke…

    Config

    library(dplyr)
    library(rnaturalearth)
    library(ggplot2)
    library(glue)

    Data

    Data from Natural Earth.

    countries <- ne_countries(scale = 110, returnclass = "sf")

    Map

    countries |> 
      ggplot() +
      geom_sf(aes(fill = if_else(sovereignt == "India", sovereignt, "Outdia")), 
              color = "gold3") +
      scale_x_continuous(expand = c(0, 0)) +
      scale_y_continuous(expand = c(0, 0)) +
      scale_fill_manual(name = "", 
                        values = list("India" = "indianred2",
                                      "Outdia" = "gold1")) +
      coord_sf(crs = "+proj=eqearth") +
      labs(title = "भारत",
           caption = glue("https://r.iresmi.net/ - {Sys.Date()}
                          data: Natural Earth")) +
      theme_void() +
      theme(plot.title = element_text(color = "indianred3", 
                                      size = 16,
                                      face = "bold"),
            plot.caption = element_text(size = 6, 
                                        color = "darkgrey"),
            plot.margin = unit(c(1, 2, 1, 2), "mm"))
    Map of India vs the rest of the world
    Figure 1: India/Outdia
    To leave a comment for the author, please follow the link and comment on their blog: r.iresmi.net.

    R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
    Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
    Continue reading: India


沪ICP备19023445号-2号
友情链接