set_theme {profiplots}R Documentation

Change default plotting behavior

Description

This function alternates the default graphics behavior (both, base R graphics and ggplot2 graphics) to follow Profinit visual guide. Be were, the recent setup is not stored anywhere before changing the values.

The function sets to defaults color and fill scales in ggplot2, R4 color palette (base graphics) and greyish color theme in ggplot2.

Usage

set_theme(pal_name = "blue-red", pal_name_discrete = "discrete", exact = NULL)

unset_theme()

Arguments

pal_name

Profinit palette name to be used. Defaults to blue-red.

pal_name_discrete

(Optional). Palette name for discrete color scales to be used by ggplot. Defaults to discrete.

exact

Indicates whether discrete values will be treated exactly as present in the palette OR whether and interpolation can take a place.

Value

The function returns nothing, it edits default behavior. Recent default configs are stored in a backup option.

The function returns nothing, it just changes default behaviour.

Functions

Examples

# Example 1 - BaseR

# As a starting point, there is a plot i base R graphic:
sample_df <- data.frame(x=1:8, y=1:8, category=as.character(1:8), col_cont = 1:8)
barplot(sample_df$y, col=sample_df$category)

# Now, by applying hte set_theme() we can change the default behavior:
profiplots::set_theme("blue-red", "blue-red")
barplot(sample_df$y, col=sample_df$category)

# To turn the theming off, just call:
profiplots::unset_theme()

# Example 2 - GGplot
library("ggplot2")
plot_gg <- ggplot(sample_df, aes(x=x, y=y, fill=category)) + stat_identity(geom="bar")
plot_gg

# Now, let's trun it into Profinit graphics.
profiplots::set_theme("blue-red", "blue-red")
plot_gg

# To remove the Profinit theme from defaults, just call:
profiplots::unset_theme()



[Package profiplots version 0.2.3 Index]