set all ggplot font sizes relative to base font size

Change-Id: I31f5740b335001d4d2826266b94746bf9391e820
2 files changed
tree: b041c7aedf1305d77cf14e6c169bc7856958f1ed
  1. demo/
  2. inst/
  3. man/
  4. R/
  5. .gitignore
  6. .gitlab-ci.yml
  7. .Rbuildignore
  8. Changelog.md
  9. DESCRIPTION
  10. idsTheme.Rproj
  11. LICENSE
  12. LICENSE.md
  13. NAMESPACE
  14. Readme.md
Readme.md

Plot themes for the Leibniz Institute for the German Language (IDS)


Description

The package provides a collection themes for different plotting libraries, following the corporate design of the Leibniz Institute for the German Language (IDS) in Mannheim (Germany).

Installation

  1. Download and install the Fira Sans Condensed font, for example from Google Fonts

  2. Install idsThemeR from its gerrit/git repository:

    library(devtools)
    install_git("https://korap.ids-mannheim.de/gerrit/IDS-Mannheim/idsThemeR")
    

Examples

highcharter – light with IDS departments palette

library(tidyverse)
library(highcharter)
library(idsThemeR)
library(htmlwidgets)
hc <- highcharts_demo() %>%
   hc_add_theme(hc_theme_ids_light(palette = "ids"))
print(hc)
saveWidget(hc, file="highchart.html")

ggplot2 – dark with default colour palette

library(ggplot2)
library(idsThemeR)

dtemp <- data.frame(months = factor(rep(substr(month.name, 1, 3), 4),
                                    levels = substr(month.name, 1, 3)),
                    city = rep(c("Tokyo", "New York", "Berlin", "London"),
                               each = 12),
                    temp = c(7.0, 6.9, 9.5, 14.5, 18.2, 21.5,
                             25.2, 26.5, 23.3, 18.3, 13.9, 9.6,
                             -0.2, 0.8, 5.7, 11.3, 17.0, 22.0,
                             24.8, 24.1, 20.1, 14.1, 8.6, 2.5,
                             -0.9, 0.6, 3.5, 8.4, 13.5, 17.0,
                             18.6, 17.9, 14.3, 9.0, 3.9, 1.0,
                             3.9, 4.2, 5.7, 8.5, 11.9, 15.2,
                             17.0, 16.6, 14.2, 10.3, 6.6, 4.8))

ggplot(dtemp, aes(x = months, y = temp, group = city, color = city)) +
  geom_line() +
  geom_point(size = 1.1) +
  ggtitle("Monthly Average Temperature") +
  theme_ids(style="dark") +
  scale_colour_ids()

ggplot2 – light with IDS departments palette

dtemp <- data.frame(Months = factor(rep(substr(month.name, 1, 3), 4),
                                    levels = substr(month.name, 1, 3)),
                    City = rep(c("Tokyo", "New York", "Berlin", "London"),
                               each = 12),
                    Temperature = c(7.0, 6.9, 9.5, 14.5, 18.2, 21.5,
                             25.2, 26.5, 23.3, 18.3, 13.9, 9.6,
                             -0.2, 0.8, 5.7, 11.3, 17.0, 22.0,
                             24.8, 24.1, 20.1, 14.1, 8.6, 2.5,
                             -0.9, 0.6, 3.5, 8.4, 13.5, 17.0,
                             18.6, 17.9, 14.3, 9.0, 3.9, 1.0,
                             3.9, 4.2, 5.7, 8.5, 11.9, 15.2,
                             17.0, 16.6, 14.2, 10.3, 6.6, 4.8))

ggplot(dtemp, aes(x = Months, y = Temperature, group = City, color = City)) +
  geom_line() +
  geom_point(size = 1.1) +
  ggtitle("Monthly Average Temperature", subtitle="Source: WorldClimate.com") +
  theme_ids() +
  scale_colour_ids(palette = "ids")

Stacked bars with ggplot2 light and default colours saved as png

subkategorien <- data.frame(Kategorie = rep(c("Ressource A", "Ressource B",
                                              "Ressource C"), each = 3),
                            Subkategorie = rep(c("Sub1", "Sub2", "Sub3"), 3),
                            Wert = rnorm(n = 9, mean = 10000, sd = 2500))

ggplot(subkategorien, aes(x = Kategorie, y = Wert, fill = Subkategorie)) +
  geom_col() +
  labs(x = "<x-Achsen-Beschriftung>",
       y = "<y-Achsen-Beschriftung>",
       title = "<Titel>",
       subtitle = "<optionaler Untertitel>") +
#  theme(axis.text.x = element_text(angle = 45, hjust = 1)) +
  theme_ids() +
  scale_fill_ids()
ggsave("./man/figures/stacked_bars.png", width = 70 * .pt, height = 40 *.pt, units = "mm", dpi = 600)

Grouped bars with ggplot2 light and default colours saved as png

subkategorien <- data.frame(Kategorie = rep(c("Ressource A", "Ressource B",
                                              "Ressource C"), each = 3),
                            Subkategorie = rep(c("Sub1", "Sub2", "Sub3"), 3),
                            Wert = rnorm(n = 9, mean = 10000, sd = 2500))

ggplot(subkategorien, aes(x = Kategorie, y = Wert, fill = Subkategorie)) +
  geom_col(position = position_dodge()) +
  labs(x = "<x-Achsen-Beschriftung>",
       y = "<y-Achsen-Beschriftung>",
       fill = "<Legendenbeschriftung>",
       title = "<Titel>",
       subtitle = "<optionaler Untertitel>") +
#  theme(axis.text.x = element_text(angle = 45, hjust = 1)) +
  theme_ids() +
  scale_fill_ids()
ggsave("./man/figures/grouped_bars.png", width = 70 * .pt, height = 40 *.pt, units = "mm", dpi = 600)

Palettes

Default: Adapted D3 based Palette

library(scales)
show_col(ids_pal()(20))

IDS Departments Palette

library(scales)
show_col(ids_pal(palette="ids")(20))

Demos

More elaborate R scripts demonstrating the use of the package can be found in the demo folder.

Changes

See Changelog

Development and License

Authors: Marc Kupietz

Copyright (c) 2020, Leibniz Institute for the German Language, Mannheim, Germany

This package is developed as part of the KorAP Corpus Analysis Platform at the Leibniz Institute for German Language (IDS).

It is published under the BSD-2 License.

Further Affected Licenses and Terms of Services

Highcharts

idsThemeR imports the highcharter package which has a dependency on Highcharts, a commercial JavaScript charting library. Highcharts offers both a commercial license as well as a free non-commercial license. Please review the licensing options and terms before using the highcharter plot options, as the idsThemeR license neither provides nor implies a license for Highcharts.

Highcharts is a Highsoft product which is not free for commercial and governmental use.

Contributions

Contributions are very welcome!

Your contributions should be committed via our Gerrit server to facilitate reviewing (see Gerrit Code Review - A Quick Introduction).

Please note that unless you explicitly state otherwise any contribution intentionally submitted for inclusion into this software shall – as this software itself – be under the BSD-2 License.