1

I have a grid of several density plots, but for readability I would like to display to the axes on only one, not all of them. I came across facet_rep_wrap from the lemon package, what is supposedly doing what I want, but it still displays all axes. What am I missing?

ggplot(2017.fixes, aes(x=Long, y=Lat) ) +
    stat_density_2d(aes(fill = ..level..), geom = "polygon", contour=T) +    
    scale_fill_distiller(palette="Spectral", direction=-1) +
    geom_polygon (data=map.df,aes(x=long, y=lat,group=group), color="grey50", fill="grey", na.rm=T) +
    geom_point(data=stations.df, aes(x=Long, y=Lat), colour="black", pch=24,bg="#00CC00", cex=1) +      
    coord_map(xlim = c(-156.95, -156.4), ylim = c(20.55, 21.05), projection="mercator") +
    theme_light() +
    facet_rep_wrap(~Date, repeat.tick.labels=F) 

enter image description here

wp78de
  • 18,207
  • 7
  • 43
  • 71
Anke
  • 527
  • 1
  • 6
  • 19
  • Can you share your data using `dput()`? – Tung Apr 30 '18 at 19:42
  • I'd rather not for confidentiality reasons. :-/ – Anke Apr 30 '18 at 20:07
  • Can you not change variable names and replace real data with made-up using `runif` or `rnorm`? – Tung Apr 30 '18 at 20:56
  • Judging from the documentation here https://cran.r-project.org/web/packages/lemon/vignettes/facet-rep-labels.html , the function `facet_rep_wrap()` is behaving as designed. Remember, the standard behavior of `facet_wrap()` is to print axis values on _all_ x and y axes. – bdemarest May 01 '18 at 01:55
  • If you want to get rid of all the axis text values, try `+ theme(axis.text=element_blank(), axis.ticks=element_blank())` – bdemarest May 01 '18 at 01:58
  • Thank you bdemarest. I stil don't quite understand why the facet_wrap() all axes is enforced when I use facet_REP_wrap instead. Is there a way to print axes on only one subplot but not the others (i.e. top left)? I don't want to get rid of ALL axes, only most Ok, I understand. facet_rep_wrap only applies for INNER axes, not outer...bummer – Anke May 01 '18 at 02:26

0 Answers0