Skip to content

Feature Request: Axis Text Warning or Automatic Rotation when Labels Overlap #3281

Closed
@billdenney

Description

@billdenney

I sometimes work with data where the axis text may overlap, and it would be helpful if ggplot either warned when the axis text overlapped or even better could automatically adjust rotation and justification when overlap occurs.

library(ggplot2)

data_with_long_names <-
  data.frame(
    A=c(paste0(rep(LETTERS, 3), collapse=""), paste0(rep(letters, 3), collapse="")),
    B=1
  )

# Feature request: This gives a warning
ggplot(data_with_long_names, aes(x=A, y=B)) +
  geom_point()

# Option for consideration as an interface to automatically fix the issue
#ggplot(data_with_long_names, aes(x=A, y=B)) +
#  geom_point() +
#  theme(axis.text.x.overlap=element_text(angle=45, hjust=1))

Created on 2019-04-30 by the reprex package (v0.2.0).

Metadata

Metadata

Assignees

No one assigned

    Labels

    featurea feature request or enhancementguides 📏wipwork in progress

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions