teunbrand / ggh4x

ggplot extension: options for tailored facets, multiple colourscales and miscellaneous
https://teunbrand.github.io/ggh4x/
Other
541 stars 33 forks source link

issue with y-axis and facer_nested #42

Closed jfouret closed 3 years ago

jfouret commented 3 years ago

hi,

I had a weird bug with your package (that I love).

with data having 6 column (x,y,cluster,batch,group,value) and the y value being different fro each "cluster".

When I run a code like below; the y ids from the first cluster are repeating themselves for each cluster's facet

I fixed different values to see point size I see differences thus only the y-axis is repeating and not all values.

ggplot(data,aes(x,y,size=value))+
facet_nest(cluster~batch+group,scales='free_y',space='free_y')+
geom_point()

lastly I did

devtools::install_github('teunbrand/ggh4x',ref='v0.1.1')

And it fixed the issue.

I will try to come up with a more reproducible example later.

teunbrand commented 3 years ago

Hi there,

Yes please, if you find a reprex that would be great.

Best wishes, Teun

teunbrand commented 3 years ago

I've tried the code below and couldn't reproduce the issue. As such, I'll be closing this issue. If somebody runs into similar problems and has code to reproduce the problem, I'll reopen the issue.

library(ggplot2)
library(ggh4x)

data <- expand.grid(cluster = 1:2,
                    batch = c("A", "B"),
                    group = 3:4)
data <- transform(
  data,
  x = rnorm(nrow(data)),
  y = rnorm(nrow(data)),
  value = rnorm(nrow(data))
)

ggplot(data, aes(x, y, size = value)) +
  geom_point() +
  facet_nested(cluster ~ batch + group,
               scales = "free_y", space = "free_y")

Created on 2021-06-23 by the reprex package (v1.0.0)