Skip to content

left margin of plot title is neglected #5578

@benimwolfspelz

Description

@benimwolfspelz

I found a problem with the margins of plot titles: The left margin of a plot title seems to be ignored if it is specified via theme().

In the following examples, I would expect to see the plot title be indented in version B as compared to version A.

# version A:
ggplot(mtcars, aes(x = cyl, y = mpg)) +
  geom_point() +
  ggtitle("Version A: no margins specified")

# version B:
ggplot(mtcars, aes(x = cyl, y = mpg)) +
  geom_point() +
  ggtitle("Version B: left margin of 20mm expected") +
  theme(plot.title = element_text(margin = margin(l = 20, unit = "mm")))

This potential bug is also reported in this stackoverflow question (not mine).

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