Skip to content

geom_text() justification docs are wrong #6033

Closed
@willgearty

Description

@willgearty

The justification docs on this page (?geom_text) are wrong (or at least misleading). These state that a value of 0 is right/bottom and a value of 1 is top/left. Whereas the specs here rightly state that 0 = bottom/left and 1 = top/right. I think the confusion comes from the fact that left justification moves items to the right and vice versa.

library(ggplot2)
ggplot(mtcars, aes(wt, mpg, label = rownames(mtcars))) +
    geom_point() +
    geom_text(hjust = 0)

ggplot(mtcars, aes(wt, mpg, label = rownames(mtcars))) +
    geom_point() +
    geom_text(hjust = 1)

Created on 2024-08-08 with reprex v2.1.1

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions