2

I created several hundred plots using ggplot and saved them all to a list. I saved the list to disk using:

save(list_of_plots,file="list_of_plots.rdata")

Now I want to display those plots and save some using ggsave. However, calling a list item just shows me components of the plot.

> names(plots00_t2[[1]])
[1] "data"        "layers"      "scales"      "mapping"     "options"    
[6] "coordinates" "facet"       "plot_env"   

Update: My dumb mistake was not loading ggplot2 when I reopened these files. However, when attempting to display these plots, I get:

Error in get("make_aesthetics", env = x, inherits = TRUE)(x, ...) : 
  could not find function "calc_aesthetics"

So short of recreating these plots, how would I fix this?

Maiasaura
  • 32,226
  • 27
  • 104
  • 108
  • Please provide a reproducible example, i.e., exact snippet of the code you used. – kohske Oct 09 '10 at 23:22
  • @kohske, agreed but this is not exactly like providing an example data frame. – Brandon Bertelsen Oct 10 '10 at 04:01
  • So Joris nailed it. I upgraded ggplot between the time I ran this set of code and when I tried to access the plots. Thanks everyone! – Maiasaura Oct 10 '10 at 17:44
  • Actually, VitoshKa nailed it before me even if he didn't realize it fully. I just provided the code for loading the elder version again without uninstalling the latest one. – Joris Meys Oct 10 '10 at 18:29

2 Answers2

2

the last version using the internal function calc_aesthetics was ggplot2 version 0.8.2. If possible, check which version of ggplot2 is used for creating the plots and load that one. Otherwise, try with version 0.8.2 or earlier.

Download the file from http://cran.r-project.org/src/contrib/Archive/ggplot2/ and save it somewhere on your computer (I used G:/Temp here). Then use this code to install and call the specific version :

install.packages(
  "G:Temp/ggplot2_0.8.2.tar.gz",
  lib="G:/Templibs",
  repos=NULL,
  type="source")

library(ggplot2,lib.loc="G:/Templibs")

After this, you should be able to print the graphs. See also this question and the help files of ?library and ?install.packages

Community
  • 1
  • 1
Joris Meys
  • 106,551
  • 31
  • 221
  • 263
1

It might happen that the code of ggplot2 was changed in meanwhile and "calc_aesthetics" is no longer available. In this case you should install an older version of ggplot2, to recover your work.

Though, the above is quite unlikely. The problem seems to stem from the fact that some parts of your plots have not been saved properly.

You should produce the traceback(), it might cast some light on the problem.

VitoshKa
  • 8,387
  • 3
  • 35
  • 59