<a id="Eunoia.eunoiaplot"></a>

# Eunoia.eunoiaplot

Julia · 1.0.1

[Source](<https://github.com/jolars/Eunoia.jl/blob/db1275ffc768591b8c9271c56d8dfa2f3351bfcd/src/Eunoia.jl>)

```julia
eunoiaplot(::AbstractEulerFit, args...; kwargs...)
```

```julia
eunoiaplot(
    fit::AbstractEulerFit;
    figure = (;),
    axis = (;),
    legend = false,
    kwargs...
)
```

```julia
eunoiaplot(
    gp::Union{Makie.GridPosition, Makie.GridSubposition},
    fit::AbstractEulerFit;
    axis = (;),
    kwargs...
)
```

```julia
eunoiaplot(fit; colors, fills, edges, labels, quantities, legend, complement,
           fontsize=14, label_placement=true, set_label_placement=false,
           glyphs=nothing, members=nothing, figure=(;), axis=(;))
eunoiaplot(gridpos, fit; axis=(;), kwargs...)
```

Render a fitted [`EulerFit`](<4ed69989ba26556a9f6f1924004c8ef9d3a879be2533c31ba480a63a0d640b42>)/[`VennFit`](<aaeedc476b437f51a25680a2e40c9055c9ecd3ca856c0fe73f756ff578293692>) as a publication-ready Makie figure (equal aspect, no axis decorations), returning a `Makie.FigureAxisPlot`. 

The second form draws into a *layout cell* of an existing figure — e.g. `eunoiaplot(f[1, 2], fit)` — mirroring Makie's `plot(fig[i, j], data)`. It creates a diagram-configured axis (equal aspect, hidden decorations) in that cell and returns a `Makie.AxisPlot`. Use it to assemble multi-panel figures without configuring each axis by hand. It takes the same styling keywords (pass an axis `title` and the like through `axis = (; title = "…")`) but does not add a legend; add a `Legend` yourself if you want one. 

This requires a Makie backend to be loaded — the implementation lives in a package extension that activates on `using CairoMakie` (or `GLMakie`/`WGLMakie`). The bare Makie `plot(fit)`/`plot!(ax, fit)` recipe forms also work once a backend is loaded. 

Styling keywords mirror the `eunoia-py` `plot()` API: 

- `colors`: per-set colors — a vector (shape order) or a `Dict(name => color)`; omitted uses a built-in categorical palette. Region fills blend the member colors perceptually (OKLab).
- `fills`: `Dict(combo => style)` per-region fill overrides.
- `edges`: set-outline style — a uniform style, a per-set `Dict`, or a vector.
- `labels`: `false`/`true`/`nothing`, a per-set `Dict`, or a uniform style.
- `quantities`: `false`/`true`, `"original"`/`"fitted"`, `"counts"`/`"percent"`, or a `Dict`.
- `legend`: `false`/`true` or a `Dict` of `Legend` keywords.
- `complement`: container-box style `Dict` (drawn only when the fit has one).
- `fontsize`: base label font size in points (quantities render smaller).

Collision-aware labels: 

- `label_placement`: `true` (default) places labels collision-aware via [`place_labels`](<2def8faa859f1c87d063429a7fddf6e003ae7162236076c186185ccd29e44288>): each region's label is measured (Makie text metrics), positioned inside its region when it fits, else pushed outside with a leader line. Set names and quantities are combined into one box per region, so a set name and its region quantity never overlap. The default uses the `"raycast"` exterior solver with straight leaders; pass a `NamedTuple`/`Dict` of [`place_labels`](<2def8faa859f1c87d063429a7fddf6e003ae7162236076c186185ccd29e44288>) strategy knobs (`placement`, `leader`, `tether`, `margin`, `iterations`, `precision`, `leader_gap`, `min_gap`) to change it, e.g. `label_placement = (; placement = "force_directed")` or `label_placement = (; leader = "elbow", tether = "boundary")`. Pass `label_placement=false` to instead draw labels at their raw anchors.
- `leader_style`: collection of `lines!` keywords styling the leader lines.
- `set_label_placement`: `false` (default) keeps set names inside their regions; `true` places them just outside their own shape, and a `NamedTuple`/`Dict` additionally forwards `margin`, `angular_steps`, `obstacles`, and `precision` to [`place_set_labels`](<9066afa58a6e34badcb91c34927b78ab6dae1725d3d585e1b4e33ea77584cff8>).
- `glyphs`: an explicit region-to-integer-count mapping. Circular glyphs are packed with [`place_glyphs`](<b66db21c9529819142a1b80eb69d4ae88e40378d3e3cae82c75ab7ab95b0790c>); use `glyph_options` for placement knobs and `glyph_style` for Makie `scatter!` attributes.
- `members`: an explicit region-to-ordered-names mapping. Names are measured, packed with [`place_glyph_boxes`](<449597d1fea745b3444efeb31886d7a3531288f1e3e8b56231a8aaeadf55c3dc>), and scaled uniformly; use `member_options` and `member_style` to customize them. `glyphs` and `members` are mutually exclusive.

Collision-aware placement needs the axis (to convert pixel text metrics to layout units), so it is available through `eunoiaplot`/`eunoiaplot!` only; the bare `plot(fit)` recipe form ignores `label_placement`. 

<a id="methods"></a>

## Methods

<a id="method-85c4c2b612ca7d96541a9c0c6289717db0d112b61a0a51efadd5a3228252b49a"></a>

### `eunoiaplot(::AbstractEulerFit, args...; kwargs...)`

[Source](<https://github.com/jolars/Eunoia.jl/blob/db1275ffc768591b8c9271c56d8dfa2f3351bfcd/src/Eunoia.jl>)

<a id="method-70e5f1f2e11c8a2e5d8616503524feaa9281bd457aa903b7cecbf98e2f8507dd"></a>

### `eunoiaplot(
    fit::AbstractEulerFit;
    figure = (;),
    axis = (;),
    legend = false,
    kwargs...
)`

[Source](<https://github.com/jolars/Eunoia.jl/blob/db1275ffc768591b8c9271c56d8dfa2f3351bfcd/ext/EunoiaMakieExt.jl>)

<a id="method-e27132eb4fb6be538005085a4cfee62227bca84fe4808e28bf145f0a2f77b3c5"></a>

### `eunoiaplot(
    gp::Union{Makie.GridPosition, Makie.GridSubposition},
    fit::AbstractEulerFit;
    axis = (;),
    kwargs...
)`

[Source](<https://github.com/jolars/Eunoia.jl/blob/db1275ffc768591b8c9271c56d8dfa2f3351bfcd/ext/EunoiaMakieExt.jl>)
