Likert Plot

Authors

[Editor] Hu Zheng;

[Contributors]

Note

Hiplot website

This page is the tutorial for source code version of the Hiplot Likert Plot plugin. You can also use the Hiplot website to achieve no code ploting. For more information please see the following link:

https://hiplot.cn/basic/likert?lang=en

Descriptive statistical analysis of Likert scale data.

Setup

  • System Requirements: Cross-platform (Linux/MacOS/Windows)

  • Programming language: R

  • Dependent packages: ggplotify; likert

# Install packages
if (!requireNamespace("ggplotify", quietly = TRUE)) {
  install.packages("ggplotify")
}
if (!requireNamespace("likert", quietly = TRUE)) {
  install.packages("likert")
}

# Load packages
library(ggplotify)
library(likert)

Data Preparation

# Load data
data <- read.delim("files/Hiplot/091-likert-data.txt", header = T)

# Convert data structure
levs <- unique(unlist(data))
for (i in 1:ncol(data)) {
  data[,i] <- factor(data[, i], levels = levs)
}

# View data
head(data)
            ST24Q01           ST24Q02        ST24Q03           ST24Q04
1 Strongly disagree    Strongly agree          Agree Strongly disagree
2          Disagree    Strongly agree Strongly agree Strongly disagree
3          Disagree          Disagree       Disagree             Agree
4          Disagree          Disagree       Disagree          Disagree
5          Disagree             Agree       Disagree Strongly disagree
6             Agree Strongly disagree          Agree Strongly disagree
            ST24Q05           ST24Q06        ST24Q07           ST24Q08
1             Agree Strongly disagree          Agree          Disagree
2    Strongly agree Strongly disagree          Agree          Disagree
3          Disagree          Disagree       Disagree          Disagree
4          Disagree Strongly disagree       Disagree          Disagree
5             Agree Strongly disagree Strongly agree Strongly disagree
6 Strongly disagree          Disagree       Disagree             Agree
            ST24Q09           ST24Q10           ST24Q11
1 Strongly disagree             Agree             Agree
2 Strongly disagree             Agree             Agree
3          Disagree          Disagree          Disagree
4 Strongly disagree          Disagree          Disagree
5 Strongly disagree Strongly disagree             Agree
6          Disagree             Agree Strongly disagree

Visualization

# Likert Plot
pobj <- likert(data)
colrs <- c("#3B4992FF","#EE0000FF")
p <- as.ggplot(plot(pobj, type = "bar", 
                    low.color = colrs[1], high.color = colrs[2], wrap = 50))

p
FigureΒ 1: Likert Plot