fastai / fastdoc

Create publication-quality books from Jupyter notebooks
https://fastai.github.io/fastdoc/
Apache License 2.0
231 stars 30 forks source link

How to change image resolution? #19

Open AllenDowney opened 3 years ago

AllenDowney commented 3 years ago

When fastdoc converts figures to png, the default resolution is too low for printing. Is there a way to either increase the resolution or generate pdf?

maxpumperla commented 3 years ago

@AllenDowney it seems there is a hardcoded conversion value for the width of images in the code

https://github.com/fastai/fastdoc/blob/master/fastdoc/asciidoc.py#L263

I guess it would be great to have command line options for this or at least override this with an environment variable at runtime.

AllenDowney commented 3 years ago

@maxpumperla Thanks for looking into this. I agree that it would be great if this were a command-line option.

For now I have worked around it by setting

plt.rcParams['figure.dpi'] = 300

At the top of the notebook and running it again.

maxpumperla commented 3 years ago

good to know that works, thank you!