Group Line

Authors

[Editor] Hu Zheng;

[Contributors]

Setup

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

  • Programming language: R

  • Dependent packages: ggplot2

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

# Load packages
library(ggplot2)

Data Preparation

# Load data
data <- read.delim("files/Hiplot/084-group-line-data.txt", header = T)

# View data
head(data)
  x        y names groups
1 1 2.253573    L1      A
2 2 2.231082    L1      A
3 3 1.740380    L1      A
4 4 2.255786    L1      A
5 5 2.429561    L1      A
6 6 1.951557    L1      A

Visualization

# Group Line
p <- ggplot(data, aes(x = x, y = y, group = names, color = groups)) +
  geom_line() +
  geom_point() +
  scale_color_manual(values = c("#e04d39","#5bbad6")) +
  theme_bw()

p
FigureΒ 1: Group Line