plotcli: ggplot2 in Your Terminal

February 9, 2026 ยท View on GitHub

CRAN status CRAN checks Downloads Downloads

plotcli: colored scatter plot in terminal

plotcli renders ggplot2 plots directly in the terminal using Unicode Braille characters and ANSI colors. Write your ggplot code as usual, then call ggplotcli() to see it in the console -- no graphics device needed.

Inspired by the excellent UnicodePlots.jl.

Installation

# From CRAN
install.packages("plotcli")

# Development version from GitHub
remotes::install_github("cheuerde/plotcli")

Quick Start

Any ggplot2 plot works. Build your plot as usual, then pass it to ggplotcli():

library(plotcli)
library(ggplot2)

p <- ggplot(mtcars, aes(x = wt, y = mpg, color = factor(cyl))) +
  geom_point() +
  labs(title = "MPG vs Weight by Cylinders",
       x = "Weight (1000 lbs)", y = "Miles per Gallon",
       color = "Cylinders") +
  theme_bw()

ggplotcli(p)

Scatter plot with colored groups

Boxplots

p <- ggplot(df, aes(x = group, y = value, fill = group)) +
  geom_boxplot() +
  labs(title = "Distribution Comparison by Group")
ggplotcli(p)

Boxplot

Line Charts

p <- ggplot(economics, aes(x = date, y = unemploy)) +
  geom_line(color = "steelblue") +
  geom_smooth(color = "red", se = FALSE) +
  labs(title = "US Unemployment Over Time")
ggplotcli(p)

Line chart

Bar Charts

Bar chart

Histograms

Histogram

Density Plots

Density plot

Heatmaps

cor_mat <- cor(mtcars[, c("mpg", "cyl", "disp", "hp", "wt", "qsec")])
df <- as.data.frame(as.table(cor_mat))
names(df) <- c("Var1", "Var2", "value")
p <- ggplot(df, aes(Var1, Var2, fill = value)) +
  geom_tile() +
  labs(title = "Correlation Heatmap", fill = "correlation")
ggplotcli(p)

Heatmap

Faceted Plots

p <- ggplot(mpg, aes(x = displ, y = hwy)) +
  geom_point(color = "steelblue") +
  geom_smooth(method = "lm", color = "red", se = FALSE) +
  facet_wrap(~drv) +
  theme_bw()
ggplotcli(p, width = 80, height = 18)

Faceted plot

Canvas Types

Block canvas -- medium resolution using block characters:

Block canvas

ASCII canvas -- basic ASCII for maximum compatibility:

ASCII canvas

Supported Geoms (27)

GeomStatus
geom_point:white_check_mark:
geom_line, geom_path:white_check_mark:
geom_step:white_check_mark:
geom_bar, geom_col, geom_histogram:white_check_mark:
geom_boxplot:white_check_mark:
geom_violin:white_check_mark:
geom_density:white_check_mark:
geom_smooth:white_check_mark:
geom_area:white_check_mark:
geom_ribbon:white_check_mark:
geom_segment, geom_hline, geom_vline, geom_abline:white_check_mark:
geom_errorbar, geom_linerange, geom_pointrange, geom_crossbar:white_check_mark:
geom_rect, geom_tile, geom_raster (heatmaps):white_check_mark:
geom_text, geom_label:white_check_mark:
geom_rug:white_check_mark:
facet_wrap, facet_grid:white_check_mark:

Options

# Control size
ggplotcli(p, width = 80, height = 24)

# Canvas types
ggplotcli(p, canvas_type = "braille")  # High resolution (default)
ggplotcli(p, canvas_type = "block")    # Block characters
ggplotcli(p, canvas_type = "ascii")    # ASCII only

Direct R6 Class Usage

For lower-level control, use the plotcli R6 class directly:

pc <- plotcli$new(plot_width = 60, plot_height = 20, x_label = "wt", y_label = "mpg",
                  title = "MPG vs Weight")
pc$add_data(list(x = mtcars$wt, y = mtcars$mpg, type = "scatter", name = "mtcars"))
pc$print_plot()

Similar Projects

  • txtplot: The OG in R
  • r-plot: Collection of excellent terminal plotting functions
  • UnicodePlots.jl: The gold standard for terminal graphics
  • plotext: Powerful terminal graphics in Python

License

plotcli is released under the LGPL-3 License.