[IPython-User] Automatically embedding PDF version of figures

Matthias BUSSONNIER bussonniermatthias@gmail....
Wed Jan 23 02:33:46 CST 2013


Hi John, 

Thank for your feedback, and happy for you that you will soon publish, 
It is nice to see people using IPython Notebook from end to end as it is our goal. 

To get back to your problem, and supposing you are using matplotlib, 
I suggest you switch the backend to SVG. 

 %config InlineBackend.figure_format = 'svg' 
for only the current session, or 
c.InlineBackend.figure_format = 'svg'
in your profile. 

Nbconvert will be smart enough to extract the svg and make pdf from them if you issue a 
$ nbconvert --format latex yourfile.ipynb

As usually the sag render well in browser, It will  not make png from svg for the html format,
but that shouldn't be too hard to add. 

Concerning the clickable png that lead to the PDF, it shouldn't need too much change
on nbconvert either, and will likely not be much more complicated than adding the link by hand in the HTML.

As we are currently rebuilding nbconvert from the ground up, those feature will probably not
be integrated in the current version, but depending how much time you have, we could 
probably hack things quickly to do something for you.

If this seem ok to you, I'll let you open a issue on nbconvert issue tracker, and then we'll see what we can do. 

-- 
Matthias
P.S: It would be nice to have IPython in the citations :-)




Le 23 janv. 2013 à 03:00, Jon Wilson a écrit :

> Hi all,
> In my field, it is customary to provide a web page documenting an 
> analysis (we invented the web, after all ;).  The principal aim is to 
> distribute the figures produced by the analysis.  Because PDF / EPS play 
> nicely with TeX, those are provided for the purpose of writing papers 
> and proceedings.  However, they don't display nicely in web browsers, so 
> raster versions are also provided.  Typically, the webpage will display 
> the raster graphic, and make the image a link to the vector graphic.
> 
> I have recently gotten into the habit of a) working in the IPython 
> notebook and b) communicating results to my colleagues using static HTML 
> views of the notebook produced by nbconvert (what a wonderful pair of 
> tools, by the way, thank you for them!).  I am, for the first time since 
> starting to use the notebook and nbconvert, in the process of making an 
> analysis public, and so I need a webpage of the type described above.
> 
> The nbconvert static HTML files very nicely embed PNG images of my 
> figures using Data URIs, all without me needing to do anything to make 
> that happen (which is nice when there are dozens of figures). Is there a 
> reasonably straightforward way to also produce PDF copies of my figures, 
> and have the PNG images link to those?  I can produce PDF figures using 
> savefig, but this requires substantial bookkeeping on my part: I have to 
> manually insert a call to savefig for every figure, and then edit the 
> static HTML to link to those files.
> 
> Could we generate the data for PDF figures and store it in an object tag 
> or something?  I'm very new to the whole concept of Data URIs, and so I 
> don't know what is possible (or reasonable) with them. What changes to 
> IPython and/or nbconvert would be necessary, assuming that Data URIs are 
> a reasonable way to go with this?
> Best regards,
> Jon
> _______________________________________________
> IPython-User mailing list
> IPython-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-user



More information about the IPython-User mailing list