Skip to content

bquote didn't work with coord_polar + scale_x_continuous #3450

@Losses

Description

@Losses

Please notice the scale of x axis:

ggplot() +
    coord_polar() +
    scale_x_continuous(limits = c(0, 2 * pi), breaks = seq(0, 1.8, by = 0.2) * pi, labels = function(x) {
      lapply(x / pi, function(x) {
        if (x == 0) {
          return(bquote(0))
        } else {
          return(bquote(.(x) * pi))
        }
      })
    }) +
    geom_vline(xintercept = 1:6)

image

ggplot() +
    scale_x_continuous(limits = c(0, 2 * pi), breaks = seq(0, 1.8, by = 0.2) * pi, labels = function(x) {
      lapply(x / pi, function(x) {
        if (x == 0) {
          return(bquote(0))
        } else {
          return(bquote(.(x) * pi))
        }
      })
    }) +
    geom_vline(xintercept = 1:6)

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behaviorcoord 🗺️

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions