Skip to content

Automatic margins based on tick label length #383

@ericemc3

Description

@ericemc3

A Plot could be internally composed in a harmonious and adaptive way, taking into account the actual bounding box of tick labels and axis titles for example, rather than having you to manually specify margins.

Here I need to enter a guestimate marginLeft:110 to accomodate labels width:

image

A manual specification of margins is not robust: if unit or data change, or the font family/size used for the axes, overlaps may occur, or unsightly gaps may appear.

Note: ggplot2 and vega-lite automatically handle margins/padding inferred from axis (and legends) bounding boxes.

Plus, an option comparable to labelOverlap in vega-lite would allow the density of tick labels on a numerical or temporal axis to be managed harmoniously, avoiding any overlap.

PS: Plot is a great library, very intellectually stimulating, and the 21 beautifully written articles in the https://observablehq.com/collection/@observablehq/plot collection should be read by all data scientists!

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions