2

I'm having a problem with cowplot as I created several graphs using ggplot but as soon as I load cowplot I can no longer obtain the same plot rerunning that ggplot script. I detached cowplot using detach(package:cowplot) and when I search for it using (.packages()) it is no longer listed. However, when I restart the session and do not load cowplot and run my ggplot script, everything is fine. Anyone else experiencing this issue? Both packages are the newest versions--ggplot2 2.2.1 and cowplot 0.9.1.

pogibas
  • 27,303
  • 19
  • 84
  • 117
TheSciGuy
  • 1,154
  • 11
  • 22
  • `detach(package:cowplot, unload = T)` – Gregor Thomas Nov 29 '17 at 20:50
  • 2
    I think you need `detach(package:cowplot, unload=TRUE)`. `cowplot` sets the ggplot theme elements to different values. However, after loading `cowplot`, instead of detaching it, you can also just reset the ggplot theme to whatever you want. For example, `theme_set(theme_bw())`. – eipi10 Nov 29 '17 at 20:50
  • 2
    @Gregor This is a duplicate, but it's a duplicate of [this post](https://stackoverflow.com/questions/41096293/cowplot-made-ggplot2-theme-disappear-how-to-see-current-ggplot2-theme-and-res). – Claus Wilke Nov 29 '17 at 20:55
  • Thanks Claus! I couldn't find a post that answered my question, but I appreciate the find! – TheSciGuy Nov 29 '17 at 20:59
  • Ah, right you are. Even unloading cowplot doesn't reset the theme. Unfortunately I can't change marked duplicate. – Gregor Thomas Nov 29 '17 at 21:06
  • It can be removed (click the "edit" button in the lower right of the "duplicate" message), but maybe it's better to just keep both links available. – eipi10 Nov 29 '17 at 21:07
  • I think it's clearer that the relevant duplicate be the only one listed, given Claus comment and the reply from the OP. I have therefore made this change to the duplicates. – Gavin Simpson Nov 29 '17 at 21:42

0 Answers0