Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transparent SVGs not rendered correctly in PDF with ipython nbconvert #2252

Closed
dpsanders opened this issue Jul 26, 2013 · 4 comments
Closed

Comments

@dpsanders
Copy link

With the new ipython nbconvert facility, a standard workflow would be as follows:

  • Create an IPython notebook with SVGs as matplotlib output:

    %config InlineBackend.figure_format = "svg"

  • Export to latex via [new syntax decided yesterday/today!]:

    ipython nbconvert --to latex mynotebook.ipynb

During this process, the SVGs produced by matplotlib get converted to PDF by inkscape, which does a great job and keeps all the transparency etc.

However, now running pdflatex or xelatex on the .tex result [which is now stored in the same directory as the original .ipynb and not inside an nbconvert_build directory] produces a PDF in which transparent PDFs are not rendered correctlly.

This is apparently a known problem, but the proposed solutions do not seem to work for me. Are there any PDF experts who can shed light on this and propose a solution? This is a deal-breaker for the PDF export at the moment, especially in combination with the new ggplot styles etc.

@BenFrantzDale
Copy link

My understanding was that PDF didn't support alpha blending.

@efiring
Copy link
Member

efiring commented Sep 29, 2013

On 2013/09/29 12:18 PM, Ben FrantzDale wrote:

My understanding was that PDF didn't support alpha blending.

PDF does, PS does not.

@mdboom
Copy link
Member

mdboom commented Sep 30, 2013

This workflow seems to work for me.

Note that figures do not have a transparent background by default. matplotlib master, but not 1.3.x has a new rcParam (thanks to @tcaswell), savefig.transparent, that will turn this on.

How are you creating the transparent figures? Maybe they aren't in fact transparent?

@pelson
Copy link
Member

pelson commented Oct 11, 2013

Closing until we have some more info. Please feel free to re-open @dpsanders with the additional information. As with @mdboom's line of inquiry, I suspect the IPython backend isn't saving the figure with a transparent background, which can now be achieved via the RcParams configuration.

Cheers,

@pelson pelson closed this as completed Oct 11, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants