{"id":13425302,"url":"https://github.com/aljrico/gameofthrones","last_synced_at":"2025-10-21T20:36:22.629Z","repository":{"id":51612731,"uuid":"159824104","full_name":"aljrico/gameofthrones","owner":"aljrico","description":"🎨 Game of Thrones inspired palette for R","archived":false,"fork":false,"pushed_at":"2022-10-06T09:27:42.000Z","size":9936,"stargazers_count":78,"open_issues_count":0,"forks_count":12,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-06T19:47:15.513Z","etag":null,"topics":["color-palette","colours","data-visualisation","data-visualization","game-of-thrones","ggplot2","house","palette","plot"],"latest_commit_sha":null,"homepage":"","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aljrico.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-11-30T13:00:21.000Z","updated_at":"2024-11-22T21:16:09.000Z","dependencies_parsed_at":"2022-08-22T14:11:14.008Z","dependency_job_id":null,"html_url":"https://github.com/aljrico/gameofthrones","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aljrico%2Fgameofthrones","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aljrico%2Fgameofthrones/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aljrico%2Fgameofthrones/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aljrico%2Fgameofthrones/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aljrico","download_url":"https://codeload.github.com/aljrico/gameofthrones/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243782004,"owners_count":20347182,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["color-palette","colours","data-visualisation","data-visualization","game-of-thrones","ggplot2","house","palette","plot"],"created_at":"2024-07-31T00:01:09.494Z","updated_at":"2025-10-21T20:36:22.605Z","avatar_url":"https://github.com/aljrico.png","language":"HTML","readme":"\n\n# gameofthrones \u003cimg src=\"man/figures/logo.png\" align=\"right\" width=\"120\" /\u003e\n\n\n\n[![cran version](http://www.r-pkg.org/badges/version/gameofthrones)](https://cran.r-project.org/package=gameofthrones)\n[![rstudio mirror per-month downloads](http://cranlogs.r-pkg.org/badges/gameofthrones)](https://github.com/metacran/cranlogs.app)\n[![rstudio mirror total downloads](http://cranlogs.r-pkg.org/badges/grand-total/gameofthrones?color=yellowgreen)](https://github.com/metacran/cranlogs.app)\n\n\nThis package provides a round of palettes inspired by the *Game of\nThrones* TV show.\n\nAt its first version, it simply contains the palettes of some of the\nhouses of Westeros. They have been chosen manually, taking into account\nits consistency with all the existing branding of the franchise, but its\nsuitability for data visualisation.\n\n\u003e Information visualization is just a language with everything to be\n\u003e discovered.\n\nA colour palette should not only be beautiful, but suitable for portraying and highlighting data. The colours of this palette has been chose trying to to find this balance between suitability for plotting\nand relatability to the world of *A Song of Ice and Fire*.\n\n\n\nInstallation\n------------\n\nJust copy and execute this bunch of code and you’ll have the last\nversion of the package installed:\n\n``` r\ndevtools::install_github(\"aljrico/gameofthrones\")\n```\n\nOr just use the more stable version on the CRAN:\n\n```r\ninstall.packages(\"gameofthrones\")\n```\n\nAnd you can now use it:\n\n``` r\nlibrary(gameofthrones)\n```\n\n\u003ccenter\u003e\u003cimg src=\"https://raw.githubusercontent.com/aljrico/gameofthrones/master/readme_raw_files/figure-markdown_github/scales_all_low.png\" \u003e\u003c/center\u003e\n\n\n\nUsage\n-----\n\nThe default colour scale of the package is the one of the house\n*Targaryen*. If you prefer to choose another one, you’ll need to specify\nwhich house you want the palette from.\n\nLet’s say that you want a palette made from the house **Targaryen**.\n\n``` r\npal \u003c- got(250, option = \"Targaryen\")\nimage(volcano, col = pal)\n```\n\u003ccenter\u003e\u003cimg src=\"https://raw.githubusercontent.com/aljrico/gameofthrones/master/readme_raw_files/figure-markdown_github/unnamed-chunk-3-1.png\" \u003e\u003c/center\u003e\n\nOr that you want _burn_ some plots down using *wildfire*.\n\n``` r\npal \u003c- got(250, option = \"Wildfire\")\nimage(volcano, col = pal)\n```\n\n\u003ccenter\u003e\u003cimg src=\"https://raw.githubusercontent.com/aljrico/gameofthrones/master/readme_raw_files/figure-markdown_github/unnamed-chunk-4-1.png\" \u003e\u003c/center\u003e\n\n\n### ggplot2\n\nOf course, this package has specific functions to behave seamlessly with\nthe best data visiualisation library available. The package contains\ncolour scale functions for **ggplot2** plots: `scale_color_got()` and\n`scale_fill_got()`.\n\nHere is a made up example using the colours from the house of\n**Martell**,\n\n``` r\nlibrary(ggplot2)\nggplot(data.frame(x = rnorm(1e4), y = rnorm(1e4)), aes(x = x, y = y)) +\n  geom_hex() + \n    coord_fixed() +\n  scale_fill_got(option = \"Martell\") + \n    theme_bw()\n```\n\u003ccenter\u003e\u003cimg src=\"https://raw.githubusercontent.com/aljrico/gameofthrones/master/readme_raw_files/figure-markdown_github/unnamed-chunk-5-1.png\" \u003e\u003c/center\u003e\n\nand **Baratheon**\n\n``` r\nggplot(data.frame(x = rnorm(1e4), y = rnorm(1e4)), aes(x = x, y = y)) +\n  geom_hex() + \n    coord_fixed() +\n  scale_fill_got(option = \"Baratheon\") + \n    theme_bw()\n```\n\n\u003ccenter\u003e\u003cimg src=\"https://raw.githubusercontent.com/aljrico/gameofthrones/master/readme_raw_files/figure-markdown_github/unnamed-chunk-6-1.png\" \u003e\u003c/center\u003e\n\n\nYou can also use it to create this cloropeth of the U.S Unemployment:\n\n\u003ccenter\u003e\u003cimg src=\"https://raw.githubusercontent.com/aljrico/gameofthrones/master/readme_raw_files/figure-markdown_github/unnamed-chunk-7-1.png\" \u003e\u003c/center\u003e\n\nBut what if you want discrete scales? These functions also can be used\nfor discrete scales with the argument `discrete = TRUE`. This argument,\nwhen TRUE, sets a finite number of sufficiently spaced colours within\nthe selected palette to plot your data. You can also bypass it by calling the function with a `_d()` at the end. So `scale_fill_got(discrete = TRUE)` becomes `scale_fill_got_d()`. Much easier, isn't it?\n\n``` r\nlibrary(gridExtra)\n\ngg1 \u003c- ggplot(diamonds, aes(factor(color), fill=factor(cut))) +  \n    geom_bar(colour = \"black\") +\n  scale_fill_got(discrete = TRUE, option = \"Margaery\") +\n    ggtitle(\"Lady Margaery\") +\n    theme_minimal()\n\ngg2 \u003c- ggplot(diamonds, aes(factor(color), fill=factor(cut))) +  \n    geom_bar(colour = \"black\") +\n  scale_fill_got_d(option = \"Daenerys\", direction = - 1) +\n    ggtitle(\"Daenerys Stormborn\") +\n    theme_minimal()\n\ngrid.arrange(gg1,gg2)\n```\n\n\u003ccenter\u003e\u003cimg src=\"https://raw.githubusercontent.com/aljrico/gameofthrones/master/readme_raw_files/figure-markdown_github/unnamed-chunk-8-1.png\" \u003e\u003c/center\u003e\n\nNote that you can also play with the direction of the colour map. Either\nthe default `direction = 1` or the opposite `direction = -1`.\n\nSee how diferently you can highlight the density distribution of restaurans in southern France.\n\n\u003ccenter\u003e\u003cimg src=\"https://raw.githubusercontent.com/aljrico/gameofthrones/master/readme_raw_files/figure-markdown_github/unnamed-chunk-9-1.png\" \u003e\u003c/center\u003e\n\n\nJust make sure you try all the options.\n\n``` r\ngg1 \u003c- ggplot(diamonds, aes(carat, fill = cut)) +\n  geom_density(position = \"stack\") +\n    scale_fill_got(discrete = TRUE, option = \"Stark2\")\n\ngg2 \u003c- ggplot(mpg, aes(class)) +\n    geom_bar(aes(fill = drv), position = position_stack(reverse = TRUE), colour = \"black\") +\n coord_flip() +\n    scale_fill_got(discrete = TRUE, option = \"Daenerys\") +\n theme(legend.position = \"top\") +\n    ylab(\"\") +\n    xlab(\"Class\")\n\ngrid.arrange(gg1,gg2)\n```\n\n\u003ccenter\u003e\u003cimg src=\"https://raw.githubusercontent.com/aljrico/gameofthrones/master/readme_raw_files/figure-markdown_github/unnamed-chunk-10-1.png\" \u003e\u003c/center\u003e\n\n\n# Palettes\n\n```r\noption = \"Arya\"\n```\n\u003ccenter\u003e\u003cimg src=\"https://raw.githubusercontent.com/aljrico/gameofthrones/master/readme_raw_files/palettes/arya.png\" width = \"75%\"\"; height=\"75%\"\u003e\u003c/center\u003e\n\n---\n\n","funding_links":[],"categories":["HTML","Themes and aesthetics"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faljrico%2Fgameofthrones","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faljrico%2Fgameofthrones","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faljrico%2Fgameofthrones/lists"}