Skip to content

Feature Request: Allow user-defined dot offsets (dot centering) in geom_dice #4

@maflot

Description

@maflot

geom_dice() currently uses fixed internal dot offsets (via make_offsets()), which determine the relative position of dots inside each dice tile. For some layouts, it is desirable to pull dot positions closer to the center of the dice (e.g., for sparse data or aesthetic consistency).
Right now, this is only possible by overriding internal functions with assignInNamespace(), which is not stable or user-friendly.

This feature request proposes adding an official argument to control dot offsets, such as a scaling or padding parameter.

Motivation

  • For sparse data, dots placed at the outer corners of the dice can look visually unbalanced.
  • Users may want a more compact, centered appearance of dice dots.
  • Overriding make_offsets() manually is hacky and fragile.
  • Providing a user parameter makes the behavior explicit, stable, and documented.

Example of a use case:

geom_dice(..., pad = 0.2)

Expected Behavior

Example:
Expose the internal padding argument used in make_offsets():

geom_dice(dots = Organ, fill = direction, pad = 0.2)

Minimal implementation

Expose pad as a user parameter in geom_dice() and pass it through to
make_offsets(). For example:

  • Add an argument pad = 0.1 to geom_dice()
  • Include pad in the params list of the layer
  • In the internals where make_offsets() is called, forward pad
    (e.g. make_offsets(n, width = width, height = height, pad = pad))

Using the current default (pad = 0.1) keeps the behavior fully
backward-compatible, while allowing users to pull the dots closer to the
center by increasing pad.

Benefits

  • Improves aesthetics for sparse dice layouts
  • Avoids hacky namespace overrides
  • Provides users with finer control without breaking defaults
  • Keeps API simple while increasing flexibility

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions