Skip to content

Unable to use save_as_pdf_pages() function. #191

Closed
@rbpatt2019

Description

@rbpatt2019

I'm trying to save a series of plots as a pdf file using a generator and the save_as_pdf_pages() function in a jupyter notebook. The data is from a large file of drug treatmenrs, and I'm plotting the data for each drug separately. Thus, I've created a generator as follows:
def plot_generator():
for drug in drugs:
yield (pn.ggplot(data) + ...)
I've simplified the actually plot code. When run independently, that works smoothly. My understanding is that I then should call save_as_pdf_pages() as follows:
pn.save_as_pdf_pages(plot_generator(), filename='my_data.pdf')
That call, however, yields the error:
AttributeError: module 'plotnine' has no attribute 'save_as_pdf_pages'
If I specifically import the ggplot class from plotnine, and call as:
ggplot.save_as_pdf_pages(plot_generator(), filename='my_data.pdf')
The error changes to:
AttributeError: type object 'ggplot' has no attribute 'save_as_pdf_pages'
When I leave the notebook and go to an iPython console, tab completion shows that the only methods in the ggplot class are draw, mro, and save. As the save_as_pdf_pages() is listed in the ggplot class on both the docs and the source code, this is odd! Has it's location moved?
I'm using plotnine v0.4.0 with python v3.6.6 installed with anaconda 5.2.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions