Skip to content

Parse problem for label axis using scales::parse_format #203

@agila5

Description

@agila5

Hi! I want to create a plot with col and axis labels that need to be firstly parsed. I read here that I have to use scales::parse_format and, while it works for the fill legend, it does not seem to work for the x axis since it shows only the ticks . Am I doing something wrong? Is this a bug?

I originally posted the same issue at the github page of ggplot2 and they suggested that this could be a bug with scales since the same example works using ggplot2 internal functions.

# packages
library(ggplot2)

# data
fake_data <- data.frame(
  classes = c("alpha", "beta"),
  value = c(1, 2),
  stringsAsFactors = FALSE
)

ggplot(fake_data) + 
  geom_col(aes(x = classes, y = value, fill = classes)) + 
  scale_fill_discrete(labels = scales::parse_format()) + 
  scale_x_discrete(labels = scales::parse_format())

Created on 2019-04-09 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