knitr::opts_chunk$set(
  collapse = TRUE,
  comment = NA
)
library(thlGraphs)

Demostration of THL's colors

There are five different types: main, quali, twoway, quanti and powerpoint.


Choosing colors by using thlColors function. Select number of colors, type and name of palette.


Example. Generate 3 colours from the quantitative color palette S2.

thlColors(n = 3, type = "quanti", name = "S2")


Displaying colors by using thlColorsDisplay function. There you can also select number of colors, type and name of palette as in thlColors function.


Example. Display 3 colors from the quantitative color palette S2.

thlColorsDisplay(n = 3, type = "quanti", name = "S2")

Type main - THL main colors

In type main is four different number of colors: 1, 2, 4 and 8.


Example. Generate 2 colors from the main color.

thlColors(n = 8, type = "main")


Example. Display 1 colors from the main color.

thlColorsDisplay(n = 1, type = "main")


Example. Display 2 colors from the main color.

thlColorsDisplay(n = 2, type = "main")


Example. Display 4 colors from the main color.

thlColorsDisplay(n = 4, type = "main")


Example. Display 8 colors from the main color.

thlColorsDisplay(n = 8, type = "main")

Type quali - THL qualitative colours

THL qualitative colors in the order in which they should be used in line plots. There is 10 different number of colors.


Example of maximum colors. Generate 6 colors from the qualitative color palette color line.

thlColors(n = 6, type = "quali", name="line")


Example of maximum colors. Display 6 colors from the qualitative color palette color line.

thlColorsDisplay(n = 6, type = "quali", name="line")


Example of maximum colors. Generate 10 colours from the qualitative color palette color bar.

thlColors(n = 10, type = "quali", name="bar")


Example of maximum colors. Display 10 colors from the qualitative color palette color bar.

thlColorsDisplay(n = 10, type = "quali", name="bar")

Type quanti - THL quantitative colours

In type quanti you can choose six different names of palette: S1,S2,S3,... or S6. Also you can choose from 1 to 7 number of colors.


Example of maximum colors. Generate 7 colors from the quantitative color palette S1.

thlColors(n = 7, type = "quanti", name="S1")


Example of maximum colors. Display 1-7 colors from the quantitative color palette S1.

thlColorsDisplay(n = 1:7, type = "quanti", name="S1")


Example of maximum colors. Generate 7 colors from the quantitative color palette S2.

thlColors(n = 7, type = "quanti", name="S2")


Example of maximum colors. Display 1-7 colors from the quantitative color palette S2.

thlColorsDisplay(n = 1:7, type = "quanti", name="S2")


Example of maximum colors. Generate 7 colors from the quantitative color palette S3.

thlColors(n = 7, type = "quanti", name="S3")


Example of maximum colors. Display 1-7 colors from the quantitative color palette S3.

thlColorsDisplay(n = 1:7, type = "quanti", name="S3")


Example of maximum colors. Generate 7 colors from the quantitative color palette S4.

thlColors(n = 7, type = "quanti", name="S4")


Example of maximum colors. Display 1-7 colors from the quantitative color palette S4.

thlColorsDisplay(n = 1:7, type = "quanti", name="S4")


Example of maximum colors. Generate 7 colors from the quantitative color palette S5.

thlColors(n = 7, type = "quanti", name="S5")


Example of maximum colors. Display 1-7 colors from the quantitative color palette S5.

thlColorsDisplay(n = 1:7, type = "quanti", name="S5")


Example of maximum colors. Generate 7 colors from the quantitative color palette S6.

thlColors(n = 7, type = "quanti", name="S6")


Example of maximum colors. Display 1-7 colors from the quantitative color palette S6.

thlColorsDisplay(n = 1:7, type = "quanti", name="S6")

Type twoway - THL twoway quantitative colors

Using twoway quantitative color palettes


THL twoway color palette K1 with 7 colors


Example of maximum colors. Generate 7 colors from the twoway quantitative color palette K1.

thlColors(n = 7, type = "twoway", name = "K1")


Displaying all different twoway palettes


Example of maximum colors. Display 3, 5, 7 and 9 colors from the twoway quantitative color palette K1.

thlColorsDisplay(n = c(3,5,7,9), type = "twoway", name = "K1")


Example of maximum colors. Display 3, 5, 7 and 9 colors from the twoway quantitative color palette K2.

thlColorsDisplay(n = c(3,5,7,9), type = "twoway", name = "K2")


Example of maximum colors. Display 3, 5, 7 and 9 colors from the twoway quantitative color palette K3.

thlColorsDisplay(n = c(3,5,7,9), type = "twoway", name = "K3")


Example of maximum colors. Display 3, 5, 7 and 9 colors from the twoway quantitative color palette K4.

thlColorsDisplay(n = c(3,5,7,9), type = "twoway", name = "K4")


Example of maximum colors. Display 3, 5, 7 and 9 colors from the twoway quantitative color palette K5.

thlColorsDisplay(n = c(3,5,7), type = "twoway", name = "K5")


Example of maximum colors. Display 3, 5, 7 and 9 colors from the twoway quantitative color palette `K6.

thlColorsDisplay(n = c(3,5,7), type = "twoway", name = "K6")

Type powerpoint

Example of maximum colors. Generate 9 colors from the powerpoint color.

thlColors(n = 9, type = "powerpoint") 


Example of maximum colors. Display 9 colors from the powerpoint color.

thlColorsDisplay(n = 9, type = "powerpoint") 

Demostration of THL's graphs

There are two different types: thlBarPlot, thlLinePlot.


Example of Bar plot. Barplot of monthly percentages (%) of patients treated over 180 days with caption year 2017. Data="yli180".

data("yli180")
yli180$pros <- as.numeric(as.character(yli180$pros))
mycaption <- c(expression(paste(bold("Lähde:"), " THL")))  ## A caption which is partially in bold
thlBarPlot(data = subset(yli180, grepl("2017", kk)), xvar = kk, yvar = pros, ylimits = c(0,2), ylabel = "%", title = "Erikoissairaanhoidosssa yli 180 vrk odottaneet", caption = mycaption)


Cont...Example of Bar plot with horizontal mode.

data("yli180")
yli180$pros <- as.numeric(as.character(yli180$pros))
mycaption <- c(expression(paste(bold("Lähde:"), " THL")))  ## A caption which is partially in bold
thlBarPlot(data = subset(yli180, grepl("2017", kk)), xvar = kk, yvar = pros, ylimits = c(0,2), ylabel = "%", title = "Erikoissairaanhoidosssa yli 180 vrk odottaneet", caption = mycaption, horizontal = TRUE)


Examples of Line plots. Data="yli180". Thl logo is included in the plot.

Default ilne plot. Data=yli90. ' ## Default line plot:

' thlLinePlot(data = subset(dat, year<2007), xvar = year, yvar = value,

' groupvar = group, ylimits = c(0,350000))

data("yli90")
yli90$AVI2<-factor(yli90$AVI, levels = yli90$AVI, labels = c("Etelä-Suomi","Lounais-Suomi","Itä-Suomi","Länsi- ja Sisä-Suomi", "Pohjois-Suomi", "Lappi"))
thlLinePlot(data = yli90, xvar = AVI2, yvar = `1/2018`, ylimits = c(0,700), ylab = "count",
title = "AVI Suomen eri osissa tammikuussa 2018",
caption="")
thlPlotLogo(label =NULL, x = .67, y = .04, size = 1, fontsize = 10)

, xaxis.breaks=c("Itä-Suomi", "Lappi")

data("yli180")
yli180$kk2<-factor(yli180$kk, levels = yli180$kk)
thlLinePlot(data = yli180, xvar = kk2, yvar = pros, ylimits = c(0,2), ylab = "%",
title = "Erikoissairaanhoidosssa yli 180 vuorokautta hoitoa \nodottaneet kolmannesvuosittain 2015 - 2018",
caption="", xaxis.breaks = c("12/2015","12/2016","12/2017","12/2018"))
thlPlotLogo(label =NULL, x = .67, y = .04, size = 1, fontsize = 10)


THLfi/thlGraphs documentation built on Oct. 31, 2019, 12:09 a.m.