Learn R Programming

eulerr

eulerr generates area-proportional Euler diagrams that display set relationships (intersections, unions, and disjoints) with circles or ellipses. Euler diagrams are Venn diagrams without the requirement that all set interactions be present (whether they are empty or not), which means that, depending on input, eulerr sometimes produces Venn diagrams and sometimes not.

With three or more sets intersecting, exact Euler diagrams are often impossible. For such cases eulerr attempts to provide a good approximation by numerically tuning the parameters of the ellipses or circles to minimize the error in the resulting diagram. Residuals and goodness of fit statistics are provided to assess whether the resulting diagram can be trusted.

Installation

Building eulerr from source requires a Rust toolchain. The minimum supported rustc version is listed in the SystemRequirements field of DESCRIPTION (currently rustc >= 1.88.0). If your system Rust is older than that, install or update via rustup before installing the package from source. CRAN binary builds do not need a local Rust toolchain.

CRAN version

install.packages("eulerr")

Development Version

devtools::install_github("jolars/eulerr")

Web App

eulerr is also available as a web app at https://eunoia.bz/app/.

Usage

library(eulerr)

set.seed(26)

# From Wilkinson 2012
fit <- euler(
  c(
    "A" = 4,
    "B" = 6,
    "C" = 3,
    "D" = 2,
    "E" = 7,
    "F" = 3,
    "A&B" = 2,
    "A&F" = 2,
    "B&C" = 2,
    "B&D" = 1,
    "B&F" = 2,
    "C&D" = 1,
    "D&E" = 1,
    "E&F" = 1,
    "A&B&F" = 1,
    "B&C&D" = 1
  ),
  shape = "ellipse"
)

We can inspect the goodness-of-fit metrics diagError and stress for the solution,

fit$stress
#> [1] 1.280319e-19
fit$diagError
#> [1] 6.774157e-11

and plot it

plot(fit)

Please see the introductory vignette for a brief introduction or eulerr under the hood for details.

Eunoia and Its Ecosystem

eulerr is based on Eunoia, which is a Rust library for fitting and visualizing Euler and Venn diagrams. The pure-Rust core powers bindings in several languages, all backed by the same fitting engine:

LanguagePackageInstall
Pythoneunoia (repo)pip install eunoia
JuliaEunoia.jl (repo)] add Eunoia
JavaScript@jolars/eunoia (repo)npm install @jolars/eunoia
Rusteunoia on crates.io (repo)cargo add eunoia

License

eulerr is open source software, licensed under the MIT license.

Versioning

eulerr uses semantic versioning.

Code of Conduct

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.

Acknowledgements

eulerr would not be possible without Ben Frederickson’s work on venn.js or Leland Wilkinson’s venneuler.

Copy Link

Version

Install

install.packages('eulerr')

Monthly Downloads

8,102

Version

8.3.1

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Johan Larsson

Last Published

September 13th, 2026

Functions in eulerr (8.3.1)

eulergram-compose

Compose Euler Diagrams
euler_plot_data

Compute polygon geometry and label anchors for plotting a fitted Euler diagram, including the optional complement region inside a fitted container.
error_plot

Error plot for euler objects
euler

Area-proportional Euler diagrams
ellipse_bounding_box

Bounding box of a vector of rotated ellipses.
eulerr_default_options

Default options for eulerr
eulerr-package

eulerr: Area-Proportional Euler and Venn Diagrams
eulerr_deprecated

Deprecated functions in package eulerr.
dummy_code

Dummy code a data.frame
ellipse_frame_to_shapes

Promote a legacy 5-column ellipse data frame (h, k, a, b, phi) into the wide $shapes schema. Used by the venn() path, where the precomputed venn-shape lookup is still expressed as ellipses.
is_false

Check if object is strictly FALSE
eulerr_options

Get or set global graphical parameters for eulerr
fitted.euler

Fitted values of euler object
fruits

Fruits
is_integer

Check if a vector is an integer
is_real

Check if vector is a real (numeric non-integer)
find_eulertags

Find the EulerTags child of an EulerPanel, if any.
get_bounding_box

Get the bounding box for a row-wise collection of fitted shapes.
fit_euler_diagram

Fit an Euler diagram using the eunoia Rust library.
expand_limits_with_canvas

Union the current xlim/ylim with the canvas bbox reported by eunoia. Returns the (possibly widened) limits.
measure_all_tags

Measure every drawable tag inside tags_grob against the current viewport. Returns parallel vectors of combo / width / height suitable for handing to place_euler_labels(), plus the resolved leader gap in native units (so the FFI sees one number per draw pass).
makeContext.EulerPanel

Set the panel viewport's xscale/yscale at draw time.
makeContent.EulerGlyphs

Place and render glyphs on the active device
measure_tag_native

Measure one tag's combined AABB in the current viewport's native units.
measure_tag

Native-unit AABB of one composite tag (label stacked above quantity, annotation stacked below quantity, separated by padding). The geometry matches what setup_tag() renders at draw time, so the size handed to eunoia agrees with the actual on-screen footprint.
makeContent.EulerTags

Re-place tags at draw time so resizing the device doesn't clip labels.
measure_tag_sizes

Measure all candidate tag sizes (regions + optional complement) inside a fresh measurement viewport scaled to xlim/ylim.
max_sets_hard_cap

Absolute upper bound on the number of sets that eunoia can represent in a single diagram. Used by the R-side input validator so the cap is not hardcoded.
makeContent.EulerSetLabels

Re-place exterior set labels on the active device
max_sets_default

Default number of sets that eunoia accepts before rejecting a spec. Used by the R-side input validator so the cap is not hardcoded.
place_euler_set_labels

Place one measured label outside each set outline.
place_euler_glyph_boxes

Pack measured member-label boxes inside exclusive regions.
organisms

Organisms
open_measurement_viewport

Open a temporary grid measurement device + viewport.
mix_colors

Blend (average) colors
place_euler_labels

Place per-region labels using eunoia's place_labels API.
place_euler_glyphs

Pack equal circular glyphs inside exclusive regions.
pain

Pain distribution data
pad_axis_native

Pad an axis range by pt_pad points, converted to native units against a measurement viewport with the supplied scale. Returns the original range unchanged if the conversion isn't finite (e.g. zero range, no device).
new_shape_frame

Allocate a fresh $shapes data frame for n_all sets. Rows for empty sets keep NA in every column so downstream plotting can detect them via is.na(shapes$h) regardless of shape kind.
plot.euler

Plot Euler and Venn diagrams
print.eulerr_venn

Print a summary of a Venn diagram
plot.eulergram

Print (plot) Euler diagram
residuals.euler

Residuals of euler object
print.euler

Print a summary of an Euler diagram
replace_list

Replace (refresh) a list
plants

Plants
resolve_placement_opts

Merge user-supplied placement options onto the defaults.
polygon_clip_rust

Clip a (possibly multi-polygon) subject path against a single clip polygon. Mirrors the slice of polyclip::polyclip behavior eulerr actually uses at the stripe-pattern site.
resolve_gap_native

Resolve a gap option to a numeric in native units inside the current measurement viewport. NULL → falls back to padding_native so the visible leader-tip gap matches the spacing between label and quantity. A grid::unit value converts to native; a bare numeric is interpreted as lines (same convention as eulerr_options()$padding).
setup_euler_set_labels

Build draw-time exterior set labels
run_placement_pass

Single placement pass: measure tags, call the Rust FFI, return the placement records and the canvas bbox returned by eunoia.
setup_geometry

Compute geometries and label locations
setup_grobs

Grobify Euler objects
setup_tag

Setup grobs for one tag (label + quantity + annotation + leader).
shape_bounding_box

Per-shape bounding box dispatch. Reads the type tag on shapes (rows are assumed to share a tag since a diagram fixes one shape kind), then picks the appropriate width/height calculation. Falls back to the rotated-ellipse formula when the type is unknown so external callers constructing ad-hoc $shapes frames still get a sensible box.
setup_euler_glyphs

Build a draw-time glyph layer
setup_complement_tag

Setup the complement-count tag, in the same shape as a region tag so it shares one makeContent.EulerTags() pass.
venn

Venn diagrams
update_list

Update list with input
tally_combinations

Tally set relationships
validate_glyph_options

Validate glyph placement controls
setup_gpar

Setup gpars
venn_layout

Canonical (non-proportional) Venn layout for a given shape.
split_waypoints

Split a placement's flat leader_waypoints_x / _y / _lengths return triple into a per-label list of list(x = ..., y = ...) coordinate pairs. Each list element has length-lengths[i] x/y vectors (often 0 — straight leaders carry no waypoints).
shapes_to_ellipse_frame

Project the wide $shapes schema back into the legacy 5-column (h, k, a, b, phi) ellipse data frame for circle/ellipse fits. Preserves the row order and row names so back-compat consumers see exactly the shape they used to.
EULER_PANEL_PAD_PT

Fixed padding in pt for the panel viewport scale.
apply_panel_overrides

Overlay per-panel overrides onto a styling parameter
detect_available_cores

Number of CPU cores eulerr may use
coef.euler

Return the fitted shape parameters from the euler object
build_tag_grobs

Build the leader / label / quantity / annotation gList for one tag.
apply_label_placement

Run eunoia label placement, expanding limits so exterior labels are not clipped. Drives one initial pass plus one re-measure pass when the limits widened by more than re_measure_threshold on the short side. Updates centers (and the complement slot on container_data) in place with placed (x, y) plus kind, tether_x, tether_y, leader_end_x, leader_end_y.
all_set_combinations

Enumerate all 2^n - 1 combination labels for a set of names
default_n_threads

Default number of threads for the fitter's restart loop
build_leader_grob

default_placement_opts

Default placement options used when the caller doesn't supply any.