Home > Net >  Add back layers in ggpubr
Add back layers in ggpubr

Time:11-17

I removed the boxplot from a ggpubr plot with the following line of code:

plot$layers <- plot$layers[-1]

I saw this solution on this Stack post: current

Target Plot Example (minus geom_text_repel label):

target

Reprex:

data = structure(list(...1 = c("1", "2", "3", "4", "5", "6", "7", "1", 
"2", "3", "4", "5", "6", "7"), subject = c("G5", "G6", "G7", 
"G8", "G12", "G13", "G14", "G5", "G6", "G7", "G8", "G12", "G13", 
"G14"), value = c(0.733377605384461, 1.65662450012502, 1.38787220722645, 
1.37053666253192, 1.62679859595799, 0.541814589221617, 0.966081047005121, 
0.892329475047538, 1.75954000718932, 1.36253416559681, 1.22104521047091, 
1.61168414813187, 0.940537918248694, 1.00171611627718), treatment = c("Drug", 
"Drug", "Drug", "Drug", "Drug", "Drug", "Drug", "Mock", "Mock", 
"Mock", "Mock", "Mock", "Mock", "Mock")), row.names = c(NA, -14L
), class = "data.frame")

CodePudding user response:

I ended up reinstalling the package and changing the width (width = 0.2 instead of width = 0), which gave me the target plot.

I believe the following line of code changes the global package settings, just FYI: plot$layers <- plot$layers[-1]

Edit: Nevermind... I'm just dumb... I think I had the width at 0, which is why it was looking funny. Please ignore me.

  • Related