[IPython-User] vector images in ipython notebook.

Jon Wilson jsw@fnal....
Wed Jun 26 17:50:25 CDT 2013


Hi Matthias,

On 06/26/2013 11:19 AM, Matthias BUSSONNIER wrote:
> you'll need dev,
> from IPython.display import FileLink, display
> savefile(name)
> disaplay(FileLink(name))
>
> Should adda link to the right file. ->right click download as.
Indeed, this works, but it requires two things which are undesireable: 
extra typing for every figure I produce, and saving the PDF rendering of 
the figure off to a local file.

The local file thing is troublesome for me for a stupid reason: Our 
collaboration's meeting-slides posting mechanism (which is a huge kludgy 
bunch of perl CGI scripts written and modified over the course of the 
last (at least) 12 years) archives posted files, but does not follow 
links (not even local/relative links) in HTML when archiving.  So, if we 
post a webpage with <img> or <a> tags that reference files in the same 
directory, all the links and images break after archiving.  OTOH, if the 
figures (and downloaded figures in <a> tags with the "download" 
attribute set) are embedded in the HTML file as "data:" URIs, then 
archiving works just fine.

There is a very nice mechanism in the notebook already whereby the 
base64 encoded PNG or SVG data is sent to the web browser and included 
in the page by javascript as a "data:" URI.  How does this mechanism 
work / which files should I read to learn how it works and thus how to 
change it to suit my purposes?  I'm working from dev from github.
Regards,
Jon


More information about the IPython-User mailing list