ud_colours: Set colours for UpAndDown plots

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/ud_colours.R

Description

Provides a colour scheme for UpAndDown plots.

Usage

1
2
ud_colours(colours = c("grey75", "grey65", "red", "blue", "green"), colors,
           gcpal=colorblind_pal()(8))

Arguments

colours

A set of colours for UpAndDown plots.

The first one is used for filling bars and the second for the borders of bars; the third one is for colouring the dashed line for the overall percentage change; the fourth one is for colouring the borders of rectangles representing the highest grouping level; the last one is for colouring the borders of a second grouping level (if there is one).

colors

To allow users to write 'colors' instead of 'colours'.

gcpal

A colour palette to use if bars are to be coloured by a grouping variable (the parameter barColour in ud_plot). The default is the colorblind palette from ggthemes, which has 8 colours. If more are needed, a palette is generated from the randomcoloR package, always using the same seed for replication purposes. The same procedure applies for a user-defined palette—if there are not enough colours, a randomcoloR palette is used.

Details

ud_colours is provided for assigning colours for UpAndDown plots.

Value

A named list of colours.

Author(s)

Antony Unwin unwin@math.uni-augsburg.de

See Also

ud_plot

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
# Using default colours
yw <- ud_prep(CPIuk, weight="Weight", v1="Aug2017", v2="Aug2018",
              levs=c("Sector"), sortLev=c("perc"))
y2 <- ud_plot(yw, labelvar="Sector")
y2$uadl

# Using individually chosen colours
library(ggthemes)
y2a <- ud_plot(yw, ud_control=ud_colours(colours = c("lightblue1", "grey50",
               "red4", "blue", "green")))
y2a$uad

# Using barColour and the default palette
# The randomcoloR palette is used as there are more than 8 sectors.
y2b <- ud_plot(yw, barColour="Sector")
y2b$uad

# Using barColour and a specified palette
y2c <- ud_plot(yw, levelColour="Sector", ud_control=ud_colours(
       gcpal= colorspace::qualitative_hcl(n = 20)))
       #randomcoloR::distinctColorPalette(k=20)))
y2c$uad

heike/UpAndDown documentation built on March 22, 2020, 7:12 p.m.