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.
# From CRAN
install.packages("plotcli")
# Development version from GitHub
remotes::install_github("cheuerde/plotcli")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)p <- ggplot(df, aes(x = group, y = value, fill = group)) +
geom_boxplot() +
labs(title = "Distribution Comparison by Group")
ggplotcli(p)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)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)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)Block canvas -- medium resolution using block characters:
ASCII canvas -- basic ASCII for maximum compatibility:
| Geom | Status |
|---|---|
geom_point |
✅ |
geom_line, geom_path |
✅ |
geom_step |
✅ |
geom_bar, geom_col, geom_histogram |
✅ |
geom_boxplot |
✅ |
geom_violin |
✅ |
geom_density |
✅ |
geom_smooth |
✅ |
geom_area |
✅ |
geom_ribbon |
✅ |
geom_segment, geom_hline, geom_vline, geom_abline |
✅ |
geom_errorbar, geom_linerange, geom_pointrange, geom_crossbar |
✅ |
geom_rect, geom_tile, geom_raster (heatmaps) |
✅ |
geom_text, geom_label |
✅ |
geom_rug |
✅ |
facet_wrap, facet_grid |
✅ |
# 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 onlyFor 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()- 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
plotcli is released under the LGPL-3 License.









