zeehio/facetscales

Error in x$clone() : attempt to apply non-function

Closed this issue · 2 comments

Hi !

I am running into trouble trying to apply your package to my data. The idea here is I want to create mirror histograms. Data looks like this:

  Coverage_side Coverage Type
1     coverage1     7152 VP03
2     coverage1     7152 VP03
3     coverage1     4252 VP03
4     coverage1     3515 VP03
5     coverage1     3515 VP03
6     coverage1     4252 VP03


........

I'm trying to run these commands:

scales_x <- list(
  Reverse = scale_x_continuous(trans="reverse"),
  Normal = scale_x_continuous()
)

ggplot(coverageplots, aes(x=Coverage, fill=Type))+
  geom_histogram(bins=40)+
  facet_grid_sc(cols = vars(Coverage_side), scales = list(x = scales_x))+
  theme_classic()

And get the following error:

Error in x$clone() : attempt to apply non-function

I am not really sure what is happening here, any suggestions ?

Thanks a lot !
Bruno

I would need a reprex.

Also I would expect sort(names(scales_x)) identical to sort(unique(coverageplots[["Coverage_side"]])) values. So maybe with

scales_x <- list(
  coverage1 = scale_x_continuous(trans="reverse"),
  coverage2 = scale_x_continuous()
)

Without a reprex I can't help you much...

Fixing the names of the scales to fit the values of Coverage_side fixed the problem indeed, thanks a lot !

And thanks in addition for addressing a recurrent problem of mine with this package :) I'll close the issue if you don't mind ?