Skip to content

Plot.text should default to tabular figures / numbers #577

Closed
@visnup

Description

@visnup

If you plot some numbers as text with a text-anchor: end, it'd be nice if the numbers were tabular and aligned horizontally by default.

For example:

Plot.plot({
  marks: [
    Plot.ruleX([0], { stroke: 'lightgray' }),
    Plot.text(
      [
        ["a", 3.4],
        ["b", 2.1],
        ["c", 12.8]
      ],
      { y: "0", text: "1", textAnchor: "end", dx: 7.5 }
    )
  ],
  width: 100
})

Produces:
untitled

Where the decimal is not quite aligned due to the thinner 1 in 2.1.

I'm pretty sure there are some arcane CSS styles that may fix this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions