rggplot2axesfacet-wrapggh4x

keeping axis labels with the same limits(no free axis) but removing inner labels facet_wrap2 (ggh4x)


I have a facet_wrap that looks good; however, I want to only have the external lines with actual numerical data and the internal graph lines with tick marks. I am not sure if there is a way top do thisDesired plotthe first image is the desired plot edited in slides and the second is an R plot that needs to be changed. plot with removed inner lables

My current code is

ggline(ACE2data2, x = "Time", y = "Fluorescence") +
  labs(x = "Time (min)", y = "RFU Ex/Em 320/420nm") +
  theme(axis.title.x = element_text(size = 22)) +
  theme(axis.title.y = element_text(size = 22)) +
  facet_wrap2(~ Dilution,
              nrow = 5,
              ncol = 4,
              axes = "all") +
  force_panelsizes(rows = unit(4, "cm"), cols = unit(4, "cm")) +
  coord_cartesian(ylim = c(0, 10000)) +
  theme(strip.text.x = element_blank(), strip.background = element_blank())

Any help is sincerely appreciated!! A big thanks in advance :)


Solution

  • If your scales are fixed, the easier solution is to use remove_labels = "all".

    Shamelessly stealing stefan's dummy data:

    library(ggplot2)
    library(ggpubr)
    library(ggh4x)
    
    ACE2data2 <- data.frame(
      Dilution = rep(1:20, each = 10),
      Time = 1:10,
      Fluorescence = 1:10
    )
    
    ggline(ACE2data2, x = "Time", y = "Fluorescence") +
      labs(x = "Time (min)", y = "RFU Ex/Em 320/420nm") +
      theme(axis.title.x = element_text(size = 22)) +
      theme(axis.title.y = element_text(size = 22)) +
      facet_wrap2(
        ~ Dilution, nrow = 5, ncol = 4,
        axes = "all", remove_labels = "all"
      ) +
      force_panelsizes(rows = unit(4, "cm"), cols = unit(4, "cm")) +
      theme(strip.text.x = element_blank(), 
            strip.background = element_blank())