# Install packages
if (!requireNamespace("data.table", quietly = TRUE)) {
install.packages("data.table")
}
if (!requireNamespace("jsonlite", quietly = TRUE)) {
install.packages("jsonlite")
}
if (!requireNamespace("fishplot", quietly = TRUE)) {
remotes::install_github("chrisamiller/fishplot")
}
# Load packages
library(data.table)
library(jsonlite)
library(fishplot)Fishplot
Note
Hiplot website
This page is the tutorial for source code version of the Hiplot Fishplot plugin. You can also use the Hiplot website to achieve no code ploting. For more information please see the following link:
Clone evolution analysis
Setup
System Requirements: Cross-platform (Linux/MacOS/Windows)
Programming language: R
Dependent packages:
data.table;jsonlite;fishplot
sessioninfo::session_info("attached")β Session info βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
setting value
version R version 4.5.2 (2025-10-31)
os Ubuntu 24.04.3 LTS
system x86_64, linux-gnu
ui X11
language (EN)
collate C.UTF-8
ctype C.UTF-8
tz UTC
date 2026-01-17
pandoc 3.1.3 @ /usr/bin/ (via rmarkdown)
quarto 1.8.27 @ /usr/local/bin/quarto
β Packages βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
package * version date (UTC) lib source
data.table * 1.18.0 2025-12-24 [1] RSPM
fishplot * 0.5.2 2025-11-02 [1] Github (chrisamiller/fishplot@3336c93)
jsonlite * 2.0.0 2025-03-27 [1] RSPM
[1] /home/runner/work/_temp/Library
[2] /opt/R/4.5.2/lib/R/site-library
[3] /opt/R/4.5.2/lib/R/library
* ββ Packages attached to the search path.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Data Preparation
# Load data
data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/fishplot/data.json")$exampleData$textarea[[1]])
data <- as.data.frame(data)
# View data
head(data) timepoints parents sample.name event1 event2 event3 event4
1 0 0 Sample1 100 2 2 98
2 30 1 Sample1 45 0 0 0
3 75 1 Sample1 0 0 2 95
4 150 3 Sample1 0 0 1 40
timepoints: specifying the timepoints for each column of the matrix
parents: specifying parental relationships between clones
samplename: samplename (support multiple samples)
other: a numeric matrix containing tumor fraction estimates for all clones at all timepoints
Visualization
## Create a fish object
fish = createFishObject(as.matrix(data[,4:7]), parents=data$parents,
timepoints=data$timepoints,
col = c("#888888","#e8130c","#f8150d","#55158f"))
## Calculate the layout of the drawing
fish = layoutClones(fish)
## Draw the plot, using the splining method (recommended), and providing both timepoints to label and a plot title
fishPlot(fish,shape="spline", title.btm="Sample1", title = "Fishplot",
cex.title=1, vlines=c(0,30,75,150),
vlab=c("Day 0","Day 30","Day 75","Day 150"))
