Skip to content

Backticks in labels when aesthetics are defined in a geom #3186

Closed
@dirkschumacher

Description

@dirkschumacher

ggplot2 adds backticks around variable labels if those variables contain a space and the aesthetics are defined in the geom and not globally.

No backticks:

library(ggplot2)
data <- tibble::tibble(
  "variable with space" = 1:5
)
ggplot(data) + 
  aes(x = `variable with space`, y = `variable with space`) +
  geom_point()

Created on 2019-03-14 by the reprex package (v0.2.1)

Backticks:

library(ggplot2)
data <- tibble::tibble(
  "variable with space" = 1:5
)
ggplot(data) + 
  geom_point(aes(x = `variable with space`, y = `variable with space`))

Created on 2019-03-14 by the reprex package (v0.2.1)

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