Storing plot objects in a list

后端 未结 5 1445
星月不相逢
星月不相逢 2020-12-03 15:04

I asked this question yesterday about storing a plot within an object. I tried implementing the first approach (aware that I did not specify that I was using qplot()

5条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-03 15:45

    There is a bug in your code concerning list subscripting. It should be

    pltList[[pltName]]
    

    not

    pltList[pltName]
    

    Note:

    class(pltList[1])
    [1] "list"
    

    pltList[1] is a list containing the first element of pltList.

    class(pltList[[1]])
    [1] "ggplot"
    

    pltList[[1]] is the first element of pltList.

提交回复
热议问题