Package 'ggthemeUL'

Title: A 'ggplot' Theme for University of Ljubljana
Description: Designed to customize 'ggplot' graphics according to the institutional identity of the University of Ljubljana.
Authors: Marjan Cugmas [aut, cre]
Maintainer: Marjan Cugmas <[email protected]>
License: GPL
Version: 0.1.3
Built: 2024-11-03 05:36:30 UTC
Source: https://github.com/cran/ggthemeUL

Help Index


University of Ljubljana theme (color) scale

Description

Applies color scale to the given data based on the University of Ljubljana's visual identity guidelines.

Usage

scale_color_ul(
  palette = "primary",
  discrete = TRUE,
  reverse = FALSE,
  midpoint = NA,
  neutralColor = "white",
  guide = guide_colourbar(frame.colour = "#58595b", title.vjust = 0.8),
  ...
)

Arguments

palette

A character string indicating the color palette to use. Default is "primary". See ?ul_pal for other options.

discrete

A logical indicating whether the scale is discrete. Default is TRUE.

reverse

A logical indicating whether to reverse the order of colors in the palette. Default is FALSE.

midpoint

A numeric value indicating the midpoint for the color scale in case of a divergent color scale (default is NA).

neutralColor

A character string specifying the color to use for neutral values (default is "white").

guide

A guide function specification, such as guide_colorbar() or guide_legend(), used to modify specific guide properties (default is guide_colourbar(frame.colour = "#58595b", title.vjust = 0.8)).

...

Other arguments passed on to the scale functions (discrete_scale, scale_color_gradientn or scale_color_gradient2).

Details

This function returns a color scale to be used with ggplot2. It uses color palettes defined according to the visual identity of the University of Ljubljana.

Value

A discrete or gradient color scale.

See Also

scale_color_gradientn, scale_color_gradient2, discrete_scale

Examples

ggplot(mtcars, aes(x = mpg, y = wt, color = factor(gear))) +
geom_point(size = 4) +
scale_color_ul()

University of Ljubljana theme (fill) scale

Description

Applies color fill to the given data based on the University of Ljubljana's visual identity guidelines.

Usage

scale_fill_ul(
  palette = "primary",
  discrete = TRUE,
  reverse = FALSE,
  midpoint = NA,
  neutralColor = "white",
  guide = guide_colourbar(frame.colour = "#58595b", title.vjust = 0.8),
  ...
)

Arguments

palette

A character string indicating the color palette to use. Default is "primary". See ?ul_pal for other options.

discrete

A logical indicating whether the scale is discrete. Default is TRUE.

reverse

A logical indicating whether to reverse the order of colors in the palette. Default is FALSE.

midpoint

A numeric value indicating the midpoint for the color scale in case of a divergent color scale (default is NA).

neutralColor

A character string specifying the color to use for neutral values (default is "white").

guide

A guide function specification, such as guide_colorbar() or guide_legend(), used to modify specific guide properties (default is guide_colourbar(frame.colour = "#58595b", title.vjust = 0.8)).

...

Other arguments passed on to the scale functions (discrete_scale, scale_fill_gradientn or scale_fill_gradient2).

Details

This function returns a color fill scale to be used with ggplot2. It uses color palettes defined according to the visual identity of the University of Ljubljana.

Value

A discrete or gradient fill scale.

See Also

scale_fill_gradientn, scale_fill_gradient2, discrete_scale

Examples

ggplot(mtcars, aes(x = mpg, fill = factor(cyl))) +
geom_density(alpha = 0.7) +
scale_fill_ul(discrete = TRUE)

Theme UL

Description

This function creates a ggplot2 theme that follows the visual identity of the University of Ljubljana.

Usage

theme_ul(
  legend.position = "top",
  panel.background.fill = "#E8E9EA",
  plot.background.fill = "white",
  panel.grid.major.color = NULL,
  legend.justification = c(0, 1),
  legend.key = element_rect(fill = "transparent"),
  text = element_text(colour = "#58595b"),
  axis.text = element_text(colour = "#58595b"),
  strip.text.x = element_text(colour = "#58595b"),
  plot.caption = element_text(hjust = 1),
  legend.title = element_text(face = "bold"),
  axis.title = element_text(face = "bold"),
  plot.title = element_text(face = "bold"),
  plot.subtitle = element_text(hjust = 0),
  legend.background = element_rect(fill = "transparent", colour = "transparent"),
  ...
)

Arguments

legend.position

A character string that specifies the position of the legend. Default is "top".

panel.background.fill

A character string that specifies the HEX code for the color of the panel background. Default is "#E8E9EA".

plot.background.fill

A character string that specifies the HEX code for the color of the plot background. Default is "white".

panel.grid.major.color

A character string that specifies the HEX code for the color of the major grid lines. If left as NULL (the default setting), the color will be automatically set according to the panel.background.fill parameter.

legend.justification

A numeric vector of length 2 that determines the justification of the legend. Default is c(0, 1).

legend.key

An element_rect object defining the appearance of the legend key. Default is element_rect(fill = "transparent").

text

A ggplot2 element specifying the appearance of text elements in the plot.

axis.text

A ggplot2 element specifying the appearance of axis text in the plot.

strip.text.x

A ggplot2 element specifying the appearance of strip text for x-axis facet labels.

plot.caption

A ggplot2 element specifying the appearance of the plot caption.

legend.title

A ggplot2 element specifying the appearance of the legend title.

axis.title

A ggplot2 element specifying the appearance of axis titles.

plot.title

A ggplot2 element specifying the appearance of the plot title.

plot.subtitle

A ggplot2 element specifying the appearance of the plot subtitle.

legend.background

A ggplot2 element specifying the appearance of the legend background.

...

Other arguments passed on to the function 'theme()'.

Value

A ggplot2 theme object that can be added to a ggplot.

See Also

theme

Examples

ggplot(data = mtcars, aes(x = disp, y = mpg, color = qsec, size = wt)) +
geom_point() +
labs(y = "Miles per gallon",
x = "Engine size (cu. in.) ",
title = "Larger engine consume more gas",
subtitle = "V-shape engines are typically larger",
caption = "Data source: Motor Trend US magazine.",
color = "1/4 mile time (seconds)",
size = "Weight (1000 lbs)") +
scale_color_ul(palette = "red", discrete = FALSE) +
theme_ul(plot.background.fill = ul_color("lajt"))

University of Ljubljana colors

Description

This function provides a set of color schemes adhering to the official visual identity of the University of Ljubljana. If no arguments are supplied, it returns all available colors. If specific color names are supplied, it will return only those colors.

Usage

ul_color(...)

Arguments

...

Optional character vectors. If color names are supplied, only those colors will be returned. If no arguments are supplied, all available colors are returned. Avaiable colors are red, antracit, medium, lajt, darkblue, navyblue, turquoise, green, yellow, orange, burgundy, and pink.

Value

A character vector of hexadecimal color codes. If no arguments are supplied, all color codes are returned. If specific color names are supplied, only the color codes for those colors are returned.

Examples

ul_color("red", "green") # Returns hexadecimal color codes for red and green
ul_color() # Returns all available colors

University of Ljubljana color palettes

Description

This function provides color palettes adhering to the official visual identity of the University of Ljubljana. It includes the primary and secondary palettes, individual color gradations, and multiple divergent color palettes.

Usage

ul_pal(palette = "primary", neutralColor = "white", reverse = FALSE, ...)

Arguments

palette

Character. The name of the palette to use.

  • Primary: "primary" (default)

  • Secondary (cold): "secondaryCold"

  • Secondary (warm): "secondaryWarm"

  • Individual colors: "red", "antracit", "medium", "lajt", "darkblue", "navyblue", "turquoise", "green", "yellow", "orange", "burgundy", "pink"

  • Divergent: "redBlue", "redGreen", "blueTurquise", "blueYellow"

neutralColor

Define the color used as neutral (default "white").

reverse

Logical. If TRUE, reverses the order of colors in the palette. Default is FALSE.

...

Additional arguments to be passed to the colorRampPalette function.

Value

A function that takes an integer argument n and returns a character vector of n colors.

Examples

pal <- ul_pal("redBlue", reverse = TRUE)
pal(7)  # Generates a reversed divergent palette of 7 colors