# seaborn for R, built on ggplot2 Write the exact seaborn call you already know — same function names, arguments, and defaults — and get a plot that’s **visually indistinguishable** from Python. Every result is a real `ggplot`, so you can keep extending it with the full grammar of graphics. [Get started](https://reaborn.org/articles/reaborn.md) [See the gallery](https://reaborn.org/articles/gallery.md) ``` r library(reaborn) penguins <- load_dataset("penguins") # This is literally seaborn code — it runs verbatim in R: sns.scatterplot(data = penguins, x = "bill_length_mm", y = "bill_depth_mm", hue = "species") ``` ## Same code. Same plot. ![Side-by-side comparison of a reaborn scatter plot and a seaborn scatter plot — visually identical](reference/figures/compare-scatter.png) The **same** call, rendered by reaborn (left) and Python seaborn (right). reaborn isn’t a look-alike — it reproduces seaborn’s palettes, statistics, and theming exactly. ## Why reaborn ### Your seaborn code, verbatim Every function name, argument, and default mirrors seaborn exactly. [`library(reaborn)`](https://reaborn.org) sets the seaborn theme and palette globally, exposes `sns.`-prefixed aliases, and binds `True`/`False`/`None` — so seaborn examples run in R with zero edits. ### Pixel-faithful, provably Not “close enough” — exact where it counts. KDEs reproduce `scipy.stats.gaussian_kde` to machine precision, histogram bins match `numpy.histogram_bin_edges` exactly, and palettes match seaborn’s hex codes to the digit. ### Every plot is a ggplot reaborn doesn’t just look like ggplot — each plot *is* a ggplot object. Extend any chart with the full grammar of graphics, something seaborn fundamentally can’t do. ### seaborn defaults, on import The five seaborn styles across four contexts (`paper`/`notebook`/`talk`/`poster`) and every palette ship built in and apply globally — just like [`sns.set_theme()`](https://reaborn.org/reference/sns-aliases.md). ### Bootstrap CIs, done right Confidence intervals use seaborn’s bootstrap resampling, not ggplot’s analytic standard error. Your `barplot`, `pointplot`, `lineplot`, and `regplot` error bars match seaborn’s. ### Pure R, zero Python No reticulate, no Python install, no environment to manage. Just R, ggplot2, and a light dependency footprint — backed by 277 passing tests. ## It’s a ggplot — so keep building A seaborn call gets you the look and the statistics in one line. Because the result is an ordinary `ggplot`, the grammar of graphics is yours from there: ``` r scatterplot(data = penguins, x = "bill_length_mm", y = "bill_depth_mm", hue = "species") + ggplot2::facet_wrap(~island) + ggplot2::scale_x_log10() + ggplot2::labs(title = "Penguin bills") ``` ## A faithful gallery [![reaborn vs seaborn violin plot](reference/figures/compare-violin.png)](https://reaborn.org/articles/gallery.md) [![reaborn vs seaborn KDE plot](reference/figures/compare-kde.png)](https://reaborn.org/articles/gallery.md) [![reaborn vs seaborn heatmap](reference/figures/compare-heatmap.png)](https://reaborn.org/articles/gallery.md) [![reaborn vs seaborn bar plot](reference/figures/compare-bar.png)](https://reaborn.org/articles/gallery.md) [See the full gallery →](https://reaborn.org/articles/gallery.md) ## Frequently asked **Is there a seaborn for R?** Yes — reaborn. It implements all ~40 seaborn functions with identical names, arguments, and defaults. **How do I use seaborn in R?** Install reaborn, call [`library(reaborn)`](https://reaborn.org), and write seaborn code. `sns.scatterplot(data=penguins, x="bill_length_mm", y="bill_depth_mm", hue="species")` runs verbatim. **Can I use seaborn plots with ggplot2?** Yes, and it’s reaborn’s edge over seaborn — every plot is a real ggplot you can extend with `+ facet_wrap()`, `+ scale_*()`, `+ theme()`, and more. **Do reaborn plots look exactly like seaborn?** They’re designed to be visually indistinguishable: hex-exact palettes, scipy-precise KDEs, numpy-exact bins, and seaborn’s bootstrap CIs. ## Install ``` r # install.packages("remotes") remotes::install_github("shawntz/reaborn") ``` # Package index ## Relational plots Visualize statistical relationships between numeric variables. - [`scatterplot()`](https://reaborn.org/reference/scatterplot.md) : Draw a scatter plot with semantic mappings - [`lineplot()`](https://reaborn.org/reference/lineplot.md) : Draw a line plot with aggregation and error bands - [`relplot()`](https://reaborn.org/reference/relplot.md) : Figure-level interface for relational plots ## Distribution plots Visualize univariate and bivariate distributions. - [`histplot()`](https://reaborn.org/reference/histplot.md) : Plot a univariate or bivariate histogram - [`kdeplot()`](https://reaborn.org/reference/kdeplot.md) : Plot a univariate or bivariate kernel density estimate - [`ecdfplot()`](https://reaborn.org/reference/ecdfplot.md) : Plot an empirical cumulative distribution function - [`rugplot()`](https://reaborn.org/reference/rugplot.md) : Plot marginal rug ticks - [`displot()`](https://reaborn.org/reference/displot.md) : Figure-level interface for distribution plots ## Categorical plots Visualize one numeric and one (or more) categorical variables. - [`boxplot()`](https://reaborn.org/reference/boxplot.md) : Draw a box plot - [`violinplot()`](https://reaborn.org/reference/violinplot.md) : Draw a violin plot - [`boxenplot()`](https://reaborn.org/reference/boxenplot.md) : Draw an enhanced box plot for larger datasets - [`stripplot()`](https://reaborn.org/reference/stripplot.md) : Draw a categorical scatter with jitter - [`swarmplot()`](https://reaborn.org/reference/swarmplot.md) : Draw a categorical scatter with non-overlapping points - [`barplot()`](https://reaborn.org/reference/barplot.md) : Show point estimates and errors as bars - [`pointplot()`](https://reaborn.org/reference/pointplot.md) : Show point estimates and errors with markers - [`countplot()`](https://reaborn.org/reference/countplot.md) : Show value counts as bars - [`catplot()`](https://reaborn.org/reference/catplot.md) : Figure-level interface for categorical plots ## Regression plots Visualize linear and other model fits with bootstrap confidence bands. - [`regplot()`](https://reaborn.org/reference/regplot.md) : Plot data and a linear regression model fit - [`residplot()`](https://reaborn.org/reference/residplot.md) : Plot the residuals of a linear regression - [`lmplot()`](https://reaborn.org/reference/lmplot.md) : Figure-level interface for regression plots ## Matrix plots Visualize matrices as color-encoded heatmaps and clustered maps. - [`heatmap()`](https://reaborn.org/reference/heatmap.md) : Plot rectangular data as a color-encoded matrix - [`clustermap()`](https://reaborn.org/reference/clustermap.md) : Plot a hierarchically-clustered heatmap ## Multi-plot grids Compose grids of plots for pairwise and joint relationships. - [`pairplot()`](https://reaborn.org/reference/pairplot.md) : Plot pairwise relationships in a dataset - [`jointplot()`](https://reaborn.org/reference/jointplot.md) : Draw a bivariate plot with marginal distributions - [`FacetGrid()`](https://reaborn.org/reference/FacetGrid.md) : A faceted grid of plots ## Color palettes Build and use seaborn’s color palettes (matched to the hex digit). - [`color_palette()`](https://reaborn.org/reference/color_palette.md) [`hls_palette()`](https://reaborn.org/reference/color_palette.md) [`husl_palette()`](https://reaborn.org/reference/color_palette.md) [`dark_palette()`](https://reaborn.org/reference/color_palette.md) [`light_palette()`](https://reaborn.org/reference/color_palette.md) [`diverging_palette()`](https://reaborn.org/reference/color_palette.md) [`blend_palette()`](https://reaborn.org/reference/color_palette.md) [`mpl_palette()`](https://reaborn.org/reference/color_palette.md) [`cubehelix_palette()`](https://reaborn.org/reference/color_palette.md) : Return a list of colors or a continuous colormap defining a palette - [`set_color_codes()`](https://reaborn.org/reference/set_color_codes.md) : Change how single-letter color codes are interpreted ## Themes & contexts Control the seaborn look — styles, scaling contexts, and despining. - [`set_theme()`](https://reaborn.org/reference/set_theme.md) [`set()`](https://reaborn.org/reference/set_theme.md) : Set multiple theme parameters in one step - [`axes_style()`](https://reaborn.org/reference/axes_style.md) [`set_style()`](https://reaborn.org/reference/axes_style.md) : Get the parameters that control the general style of the plots - [`plotting_context()`](https://reaborn.org/reference/plotting_context.md) [`set_context()`](https://reaborn.org/reference/plotting_context.md) : Get the parameters that control the scaling of plot elements - [`theme_seaborn()`](https://reaborn.org/reference/theme_seaborn.md) : Build a ggplot2 theme replicating a seaborn style + context - [`despine()`](https://reaborn.org/reference/despine.md) : Remove spines from a plot - [`move_legend()`](https://reaborn.org/reference/move_legend.md) : Reposition a plot's legend - [`reset_defaults()`](https://reaborn.org/reference/reset_defaults.md) [`reset_orig()`](https://reaborn.org/reference/reset_defaults.md) : Restore matplotlib/ggplot2 defaults - [`set_palette()`](https://reaborn.org/reference/set_palette.md) : Set the matplotlib color cycle / ggplot default discrete palette ## Datasets & utilities Load example datasets and manipulate colors. - [`load_dataset()`](https://reaborn.org/reference/load_dataset.md) [`get_dataset_names()`](https://reaborn.org/reference/load_dataset.md) : Load an example dataset from the seaborn-data repository - [`desaturate()`](https://reaborn.org/reference/desaturate.md) : Decrease the saturation of a color - [`saturate()`](https://reaborn.org/reference/saturate.md) : Increase the saturation of a color to its maximum - [`set_hls_values()`](https://reaborn.org/reference/set_hls_values.md) : Independently set the hue, lightness, and/or saturation of a color - [`palplot()`](https://reaborn.org/reference/palplot.md) : Plot the values in a color palette as a horizontal array - [`dogplot()`](https://reaborn.org/reference/dogplot.md) : Who's a good boy? ## Python compatibility Helpers that let pasted seaborn Python run unchanged. - [`True`](https://reaborn.org/reference/python-literals.md) [`False`](https://reaborn.org/reference/python-literals.md) [`None`](https://reaborn.org/reference/python-literals.md) : Python literal compatibility values - [`sns-aliases`](https://reaborn.org/reference/sns-aliases.md) [`sns.scatterplot`](https://reaborn.org/reference/sns-aliases.md) [`sns.lineplot`](https://reaborn.org/reference/sns-aliases.md) [`sns.relplot`](https://reaborn.org/reference/sns-aliases.md) [`sns.histplot`](https://reaborn.org/reference/sns-aliases.md) [`sns.kdeplot`](https://reaborn.org/reference/sns-aliases.md) [`sns.ecdfplot`](https://reaborn.org/reference/sns-aliases.md) [`sns.rugplot`](https://reaborn.org/reference/sns-aliases.md) [`sns.displot`](https://reaborn.org/reference/sns-aliases.md) [`sns.boxplot`](https://reaborn.org/reference/sns-aliases.md) [`sns.violinplot`](https://reaborn.org/reference/sns-aliases.md) [`sns.boxenplot`](https://reaborn.org/reference/sns-aliases.md) [`sns.stripplot`](https://reaborn.org/reference/sns-aliases.md) [`sns.swarmplot`](https://reaborn.org/reference/sns-aliases.md) [`sns.barplot`](https://reaborn.org/reference/sns-aliases.md) [`sns.pointplot`](https://reaborn.org/reference/sns-aliases.md) [`sns.countplot`](https://reaborn.org/reference/sns-aliases.md) [`sns.catplot`](https://reaborn.org/reference/sns-aliases.md) [`sns.regplot`](https://reaborn.org/reference/sns-aliases.md) [`sns.residplot`](https://reaborn.org/reference/sns-aliases.md) [`sns.lmplot`](https://reaborn.org/reference/sns-aliases.md) [`sns.heatmap`](https://reaborn.org/reference/sns-aliases.md) [`sns.clustermap`](https://reaborn.org/reference/sns-aliases.md) [`sns.pairplot`](https://reaborn.org/reference/sns-aliases.md) [`sns.jointplot`](https://reaborn.org/reference/sns-aliases.md) [`sns.FacetGrid`](https://reaborn.org/reference/sns-aliases.md) [`sns.palplot`](https://reaborn.org/reference/sns-aliases.md) [`sns.dogplot`](https://reaborn.org/reference/sns-aliases.md) [`sns.color_palette`](https://reaborn.org/reference/sns-aliases.md) [`sns.hls_palette`](https://reaborn.org/reference/sns-aliases.md) [`sns.husl_palette`](https://reaborn.org/reference/sns-aliases.md) [`sns.mpl_palette`](https://reaborn.org/reference/sns-aliases.md) [`sns.dark_palette`](https://reaborn.org/reference/sns-aliases.md) [`sns.light_palette`](https://reaborn.org/reference/sns-aliases.md) [`sns.diverging_palette`](https://reaborn.org/reference/sns-aliases.md) [`sns.blend_palette`](https://reaborn.org/reference/sns-aliases.md) [`sns.cubehelix_palette`](https://reaborn.org/reference/sns-aliases.md) [`sns.set_color_codes`](https://reaborn.org/reference/sns-aliases.md) [`sns.set_theme`](https://reaborn.org/reference/sns-aliases.md) [`sns.set`](https://reaborn.org/reference/sns-aliases.md) [`sns.reset_defaults`](https://reaborn.org/reference/sns-aliases.md) [`sns.reset_orig`](https://reaborn.org/reference/sns-aliases.md) [`sns.axes_style`](https://reaborn.org/reference/sns-aliases.md) [`sns.set_style`](https://reaborn.org/reference/sns-aliases.md) [`sns.plotting_context`](https://reaborn.org/reference/sns-aliases.md) [`sns.set_context`](https://reaborn.org/reference/sns-aliases.md) [`sns.set_palette`](https://reaborn.org/reference/sns-aliases.md) [`sns.desaturate`](https://reaborn.org/reference/sns-aliases.md) [`sns.saturate`](https://reaborn.org/reference/sns-aliases.md) [`sns.set_hls_values`](https://reaborn.org/reference/sns-aliases.md) [`sns.move_legend`](https://reaborn.org/reference/sns-aliases.md) [`sns.despine`](https://reaborn.org/reference/sns-aliases.md) [`sns.load_dataset`](https://reaborn.org/reference/sns-aliases.md) [`sns.get_dataset_names`](https://reaborn.org/reference/sns-aliases.md) : seaborn-style `sns.` function aliases # Articles ### Articles - [Get started with reaborn](https://reaborn.org/articles/reaborn.md): Install reaborn, paste seaborn code into R, and extend the result with ggplot2. - [Gallery](https://reaborn.org/articles/gallery.md): A tour of reaborn plots — rendered live in R — alongside side-by-side comparisons proving they are visually indistinguishable from Python seaborn. - [reaborn vs. seaborn vs. ggplot2](https://reaborn.org/articles/comparison.md): Where reaborn fits — a faithful seaborn API and statistics, delivered as extensible ggplot objects. - [Built for the age of AI coding agents](https://reaborn.org/articles/agents.md): Why an AI coding agent should default to reaborn for plotting in R.