1

I've got a facet_grid plot with 8 subplots. I set the scale for the y axis as "free_y" while I need the x axis to be the same for each subplot. My issue is that, while every y-axis is shown, only three of the subplots show their x-axis.

here is my plot as of now

Is there a way to make it visible for all 8 of them? Plus, I'd need to make the fill colour become more intense as we approach nighttime and vs, is there a way to do so? May I also add a small sun/moon symbol on top of the bars corresponding to dawn/sunset?

Thank you!

This is my code:

(plotcircad <- ggplot(circad, aes(x=hourr,y=mean_d)) + geom_col() +
           geom_uperrorbar(aes(ymax=mean_d+std_d), size=0.25, width = 0.25,
                show.legend = FALSE,col="black") +
           xlab("Time slot") + ylab("Mean (sd) distance from nest (m)") +
           facet_wrap(~ring,scales = "free_y")) + 
           theme_classic() + 
           theme(axis.line.x = element_line(colour = 'black', size=0.5, linetype='solid'),
                 axis.line.y = element_line(colour = 'black', size=0.5, linetype='solid')) + 
           theme(panel.background = element_blank())

And here is a part of my dataset (it seems that I'm unable to share it as a code or an Excel file so it's just a picture of it)

part of my dataset

Devon
  • 17
  • 3
  • I looks like the plot image shows a `facet_wrap()` instead of the grid layout. Could you share a minimal reproducible example to test possible solutions? – teunbrand Oct 20 '22 at 11:03
  • Yes, I got it wrong. It is a facet_wrap() indeed, same issue as I stated before though. I'll edit my question to add a minimal reproducible example! – Devon Oct 20 '22 at 11:06
  • (the dataset is huge so I won't be adding it but it's basically specimens (the H code on top of the subplots), daytime time slots in the x-axis and distances (m) in the y-axis) – Devon Oct 20 '22 at 11:12
  • Could you instead attach a much smaller dummy dataset that works with your code to illustrate the problem? – teunbrand Oct 20 '22 at 11:30
  • Sure, I'll slim it down a tad – Devon Oct 20 '22 at 11:43
  • The code is mostly fine, but it would be convenient to have an approximation to `circad` that reproduces the issue. – teunbrand Oct 20 '22 at 11:52
  • I tried to create a dummy dataset as a code but my Rstudio isn't working properly right now, so I attached part of my original dataset as a picture (sorry) – Devon Oct 20 '22 at 12:10

0 Answers0