GOBar Plot

Authors

[Editor] Hu Zheng;

[Contributors]

Modified

2026-10-27

🤖 AI Skill — Download the Bizard unified skill for your AI assistant ⬇️ Download Skill ZIP
🔌 MCP Server — Let AI agents (Claude Code, Cursor, …) query Bizard live: claude mcp add bizard -- npx @openbiox/bizard-mcp — or the free hosted instance (no install, faster from mainland China): claude mcp add --transport http bizard http://biotree.top:38123/bizard-mcp/mcp 📖 MCP Docs
📖 Cite Bizard — if Bizard helps your research, please cite: Li, K., Zheng, H., Huang, K., et al. (2026). Bizard: A Community-Driven Platform for Accelerating and Enhancing Biomedical Data Visualization. iMetaMed, e70038. 🔗 DOI / BibTeX
Note

Hiplot website

This page is the tutorial for source code version of the Hiplot GOBar 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/gobar?lang=en

The gobar plot is used to display Z-score coloured barplot of terms ordered alternatively by z-score or the negative logarithm of the adjusted p-value.

Setup

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

  • Programming language: R

  • Dependent packages: data.table; jsonlite; GOplot

# Install packages
if (!requireNamespace("data.table", quietly = TRUE)) {
  install.packages("data.table")
}
if (!requireNamespace("jsonlite", quietly = TRUE)) {
  install.packages("jsonlite")
}
if (!requireNamespace("GOplot", quietly = TRUE)) {
  install.packages("GOplot")
}

# Load packages
library(data.table)
library(jsonlite)
library(GOplot)
sessioninfo::session_info("attached")
─ Session info ───────────────────────────────────────────────────────────────
 setting  value
 version  R version 4.6.0 (2026-04-24)
 os       Ubuntu 24.04.4 LTS
 system   x86_64, linux-gnu
 ui       X11
 language (EN)
 collate  C.UTF-8
 ctype    C.UTF-8
 tz       UTC
 date     2026-05-09
 pandoc   3.1.3 @ /usr/bin/ (via rmarkdown)
 quarto   1.9.37 @ /usr/local/bin/quarto

─ Packages ───────────────────────────────────────────────────────────────────
 package      * version    date (UTC) lib source
 data.table   * 1.18.4     2026-05-06 [1] RSPM
 ggdendro     * 0.2.0      2024-02-23 [1] RSPM
 ggplot2      * 4.0.3.9000 2026-05-04 [1] Github (tidyverse/ggplot2@6870419)
 GOplot       * 1.0.2      2016-03-30 [1] RSPM
 gridExtra    * 2.3        2017-09-09 [1] RSPM
 jsonlite     * 2.0.0      2025-03-27 [1] RSPM
 RColorBrewer * 1.1-3      2022-04-03 [1] RSPM

 [1] /home/runner/work/_temp/Library
 [2] /opt/R/4.6.0/lib/R/site-library
 [3] /opt/R/4.6.0/lib/R/library
 * ── Packages attached to the search path.

──────────────────────────────────────────────────────────────────────────────

Data Preparation

The loaded data are the results of GO enrichment with seven columns: category, GO id, GO term, gene count, gene name, logFC, adjust pvalue and zscore.

# Load data
data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/gobar/data.json")$exampleData$textarea[[1]])
data <- as.data.frame(data)

# Convert data structure
colnames(data) <- c("category","ID","term","count","genes","logFC","adj_pval","zscore")
data <- data[data$category %in% c("BP","CC","MF"),]
data <- data[!is.na(data$adj_pval),]
data$adj_pval <- as.numeric(data$adj_pval)
data$zscore <- as.numeric(data$zscore)

# View data
head(data)
  category         ID              term count  genes      logFC adj_pval
1       BP GO:0007507 heart development    54   DLC1 -0.9707875 2.17e-06
2       BP GO:0007507 heart development    54   NRP2 -1.5153173 2.17e-06
3       BP GO:0007507 heart development    54   NRP1 -1.1412315 2.17e-06
4       BP GO:0007507 heart development    54   EDN1  1.3813006 2.17e-06
5       BP GO:0007507 heart development    54 PDLIM3 -0.8876939 2.17e-06
6       BP GO:0007507 heart development    54   GJA1 -0.8179480 2.17e-06
      zscore
1 -0.8164966
2 -0.8164966
3 -0.8164966
4 -0.8164966
5 -0.8164966
6 -0.8164966

Visualization

# GOBar Plot
p <- GOBar(data, display = "multiple", order.by.zscore = T,
           title = "GO Enrichment Barplot ", 
           zsc.col = c("#EF8A62","#F7F7F7","#67A9CF")) + 
    theme(plot.title = element_text(hjust = 0.5),
          axis.text.x = element_text(size = 8))

p
Figure 1: GOBar Plot

As shown in the example figure, the x-axis represent each GO term, the y-axis represent the -log(adj_pvalue), each bar is colored by the z-score. If display is used to facet the plot the width of the panels will be proportional to the length of the x scale.