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 |
Applies color scale to the given data based on the University of Ljubljana's visual identity guidelines.
scale_color_ul( palette = "primary", discrete = TRUE, reverse = FALSE, midpoint = NA, neutralColor = "white", guide = guide_colourbar(frame.colour = "#58595b", title.vjust = 0.8), ... )
scale_color_ul( palette = "primary", discrete = TRUE, reverse = FALSE, midpoint = NA, neutralColor = "white", guide = guide_colourbar(frame.colour = "#58595b", title.vjust = 0.8), ... )
palette |
A character string indicating the color palette to use. Default is |
discrete |
A logical indicating whether the scale is discrete. Default is |
reverse |
A logical indicating whether to reverse the order of colors in the palette. Default is |
midpoint |
A numeric value indicating the midpoint for the color scale in case of a divergent color scale (default is |
neutralColor |
A character string specifying the color to use for neutral values (default is |
guide |
A guide function specification, such as |
... |
Other arguments passed on to the scale functions ( |
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.
A discrete or gradient color scale.
scale_color_gradientn
, scale_color_gradient2
, discrete_scale
ggplot(mtcars, aes(x = mpg, y = wt, color = factor(gear))) + geom_point(size = 4) + scale_color_ul()
ggplot(mtcars, aes(x = mpg, y = wt, color = factor(gear))) + geom_point(size = 4) + scale_color_ul()
Applies color fill to the given data based on the University of Ljubljana's visual identity guidelines.
scale_fill_ul( palette = "primary", discrete = TRUE, reverse = FALSE, midpoint = NA, neutralColor = "white", guide = guide_colourbar(frame.colour = "#58595b", title.vjust = 0.8), ... )
scale_fill_ul( palette = "primary", discrete = TRUE, reverse = FALSE, midpoint = NA, neutralColor = "white", guide = guide_colourbar(frame.colour = "#58595b", title.vjust = 0.8), ... )
palette |
A character string indicating the color palette to use. Default is |
discrete |
A logical indicating whether the scale is discrete. Default is |
reverse |
A logical indicating whether to reverse the order of colors in the palette. Default is |
midpoint |
A numeric value indicating the midpoint for the color scale in case of a divergent color scale (default is |
neutralColor |
A character string specifying the color to use for neutral values (default is |
guide |
A guide function specification, such as |
... |
Other arguments passed on to the scale functions ( |
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.
A discrete or gradient fill scale.
scale_fill_gradientn
, scale_fill_gradient2
, discrete_scale
ggplot(mtcars, aes(x = mpg, fill = factor(cyl))) + geom_density(alpha = 0.7) + scale_fill_ul(discrete = TRUE)
ggplot(mtcars, aes(x = mpg, fill = factor(cyl))) + geom_density(alpha = 0.7) + scale_fill_ul(discrete = TRUE)
This function creates a ggplot2 theme that follows the visual identity of the University of Ljubljana.
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"), ... )
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"), ... )
legend.position |
A character string that specifies the position of the legend. Default is |
panel.background.fill |
A character string that specifies the HEX code for the color of the panel background. Default is |
plot.background.fill |
A character string that specifies the HEX code for the color of the plot background. Default is |
panel.grid.major.color |
A character string that specifies the HEX code for the color of the major grid lines. If left as |
legend.justification |
A numeric vector of length 2 that determines the justification of the legend. Default is |
legend.key |
An |
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()'. |
A ggplot2 theme object that can be added to a ggplot.
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"))
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"))
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.
ul_color(...)
ul_color(...)
... |
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. |
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.
ul_color("red", "green") # Returns hexadecimal color codes for red and green ul_color() # Returns all available colors
ul_color("red", "green") # Returns hexadecimal color codes for red and green ul_color() # Returns all available colors
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.
ul_pal(palette = "primary", neutralColor = "white", reverse = FALSE, ...)
ul_pal(palette = "primary", neutralColor = "white", reverse = FALSE, ...)
palette |
Character. The name of the palette to use.
|
neutralColor |
Define the color used as neutral (default |
reverse |
Logical. If |
... |
Additional arguments to be passed to the |
A function that takes an integer argument n and returns a character vector of n colors.
pal <- ul_pal("redBlue", reverse = TRUE) pal(7) # Generates a reversed divergent palette of 7 colors
pal <- ul_pal("redBlue", reverse = TRUE) pal(7) # Generates a reversed divergent palette of 7 colors