<a id="quickstart-r"></a>

# Quickstart: R

[`eulerr`](<https://cran.r-project.org/package=eulerr>) is the R binding: the original package, now backed by the eunoia engine. You hand `euler()` a named vector of set sizes, it fits an area-proportional diagram, and `plot()` draws it with grid graphics. 

<a id="docs-quickstart-r-1"></a>

The diagram fitted by the first example below. 

<a id="install"></a>

## Install

```r
install.packages("eulerr")
```

CRAN ships binary builds, so no Rust toolchain is needed. (Installing from source does require `rustc` ≥ 1.88; see the package README.) 

<a id="fit-a-diagram"></a>

## Fit a Diagram

```r
library(eulerr)

fit <- euler(c(A = 5, B = 3, "A&B" = 1.5))
fit # prints the residual table and goodness-of-fit metrics
plot(fit)
```

The input is a named numeric vector. Names are **combination expressions**: a single set (`A`) or sets joined with `&` (`"A&B"`). Values are *disjoint* (exclusive) by default: the part of `A` outside `B` is `5`, the overlap is `1.5`. Pass `input = "union"` if your numbers are full set sizes instead. 

`fit` carries the fitted geometry and fit statistics: 

```r
fit$shapes # data frame of fitted geometry for the selected shape
fit$stress # goodness-of-fit (venneuler-style)
fit$diagError # largest single-region error
```

<a id="pick-a-different-shape"></a>

## Pick a Different Shape

```r
fit <- euler(c(A = 5, B = 3, "A&B" = 1.5), shape = "ellipse")
plot(fit)
```

`shape` is one of `"circle"` (default), `"ellipse"`, `"square"`, `"rectangle"`, or `"rotated_rectangle"`. Ellipses are more flexible and often fit three or more sets noticeably better. Rotated rectangles add an angle to the width and height and use derivative-free fitting; see [Shapes](/docs/concepts/shapes/). 

<a id="customize-the-plot"></a>

## Customize the Plot

`plot()` takes styling arguments for fills, edges, labels, and quantities: 

```r
plot(
  fit,
  quantities = TRUE,
  fills = c("#e41a1c", "#377eb8"),
  labels = list(fontsize = 14)
)
```

<a id="venn-diagrams"></a>

## Venn Diagrams

For a fixed, *non*-proportional Venn template (every intersection shown regardless of size), use `venn()`: 

```r
plot(venn(c("A", "B", "C"))) # three-set Venn
plot(venn(3)) # same, by set count
plot(venn(4, shape = "rotated_rectangle"))
```

`venn()` defaults to ellipses, supporting up to five sets. Rotated rectangles support up to four sets. 

<a id="next-steps"></a>

## Next Steps

Read the [introductory vignette](<https://cran.r-project.org/package=eulerr/vignettes/introduction.html>) and the full reference on the [eulerr website](<https://jolars.github.io/eulerr/>). For how the fit works across all bindings, see the [Fitter Pipeline](/docs/concepts/fitter-pipeline/) and [Goodness of Fit](/docs/concepts/goodness-of-fit/) chapters.
