Skip to content

label_bquote turns numeric values into factors (?) when as.table = FALSE in facet_grid #6864

@JesseBrunner

Description

@JesseBrunner

I found a problem with label_bquote. I was trying to use an expression show the value of a parameter in the facet labels and I found that when I used as.table = FALSE the values of the rows were instead turned into integers. I am guessing this is because the values were first turned into factors and then faceted, but I am not sure.

Here is the code to reproduce the bug:

library(tidyverse)

expand_grid(a = c(0.15, 0.85),
            b = c(0.001, 0.0025, 0.005), 
            x = rnorm(10), 
            y = rnorm(10)) %>% 
ggplot(., aes(x,y)) + 
  geom_point() + 
  facet_grid(a ~ b, 
             as.table = F, # <- works when this is TRUE
             labeller = label_bquote(rows = alpha==.(a), 
                                     cols = beta==.(b)))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions