ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sat, 09 Feb 2013 10:02:14 +0100No fillalpha after eps export?https://ask.sagemath.org/question/9779/no-fillalpha-after-eps-export/Hey guys,
this is a slightly modified example from the sage help pages:
(plot(1+e^(-x^2), xmin=-2, xmax=2, ymin=0, ymax=2.5, fill=0.5, fillcolor='green', fillalpha=0.5)).save('t.eps')
It shows an exponential function which is filled from below by green color. The option fillalpha=0.5 should make this filling slightly transparent, which works perfectly when exporting to pdf, but repdroducably fails when exporting to eps. Is there any workaround?Wed, 06 Feb 2013 13:51:53 +0100https://ask.sagemath.org/question/9779/no-fillalpha-after-eps-export/Answer by kcrisman for <p>Hey guys,</p>
<p>this is a slightly modified example from the sage help pages:</p>
<p>(plot(1+e^(-x^2), xmin=-2, xmax=2, ymin=0, ymax=2.5, fill=0.5, fillcolor='green', fillalpha=0.5)).save('t.eps')</p>
<p>It shows an exponential function which is filled from below by green color. The option fillalpha=0.5 should make this filling slightly transparent, which works perfectly when exporting to pdf, but repdroducably fails when exporting to eps. Is there any workaround?</p>
https://ask.sagemath.org/question/9779/no-fillalpha-after-eps-export/?answer=14509#post-id-14509The problem is in our `Polygon` class - somehow it's not saving correctly. Compare these.
sage: polygon([(0,0), (1,1), (0,1)],alpha=.1).save('test.pdf')
sage: polygon([(0,0), (1,1), (0,1)],alpha=.1).save('test.eps')
If I can narrow it down a little more, I'll open a ticket. It's conceivable that it's a matplotlib issue, but I'd guess it's ours first.
Wed, 06 Feb 2013 20:54:45 +0100https://ask.sagemath.org/question/9779/no-fillalpha-after-eps-export/?answer=14509#post-id-14509Comment by ppurka for <p>The problem is in our <code>Polygon</code> class - somehow it's not saving correctly. Compare these.</p>
<pre><code>sage: polygon([(0,0), (1,1), (0,1)],alpha=.1).save('test.pdf')
sage: polygon([(0,0), (1,1), (0,1)],alpha=.1).save('test.eps')
</code></pre>
<p>If I can narrow it down a little more, I'll open a ticket. It's conceivable that it's a matplotlib issue, but I'd guess it's ours first.</p>
https://ask.sagemath.org/question/9779/no-fillalpha-after-eps-export/?comment=18277#post-id-18277I have updated the ticket after opening an upstream mpl bug https://github.com/matplotlib/matplotlib/issues/1740Fri, 08 Feb 2013 04:11:36 +0100https://ask.sagemath.org/question/9779/no-fillalpha-after-eps-export/?comment=18277#post-id-18277Comment by kcrisman for <p>The problem is in our <code>Polygon</code> class - somehow it's not saving correctly. Compare these.</p>
<pre><code>sage: polygon([(0,0), (1,1), (0,1)],alpha=.1).save('test.pdf')
sage: polygon([(0,0), (1,1), (0,1)],alpha=.1).save('test.eps')
</code></pre>
<p>If I can narrow it down a little more, I'll open a ticket. It's conceivable that it's a matplotlib issue, but I'd guess it's ours first.</p>
https://ask.sagemath.org/question/9779/no-fillalpha-after-eps-export/?comment=18276#post-id-18276And now matplotlib says this is actually not supported by ps. Fri, 08 Feb 2013 10:02:17 +0100https://ask.sagemath.org/question/9779/no-fillalpha-after-eps-export/?comment=18276#post-id-18276Comment by kcrisman for <p>The problem is in our <code>Polygon</code> class - somehow it's not saving correctly. Compare these.</p>
<pre><code>sage: polygon([(0,0), (1,1), (0,1)],alpha=.1).save('test.pdf')
sage: polygon([(0,0), (1,1), (0,1)],alpha=.1).save('test.eps')
</code></pre>
<p>If I can narrow it down a little more, I'll open a ticket. It's conceivable that it's a matplotlib issue, but I'd guess it's ours first.</p>
https://ask.sagemath.org/question/9779/no-fillalpha-after-eps-export/?comment=18287#post-id-18287See http://trac.sagemath.org/sage_trac/ticket/14074 - my guess is still that we are doing something wrong, but it could be an mpl bug, in principle.Wed, 06 Feb 2013 21:11:59 +0100https://ask.sagemath.org/question/9779/no-fillalpha-after-eps-export/?comment=18287#post-id-18287Comment by ppurka for <p>The problem is in our <code>Polygon</code> class - somehow it's not saving correctly. Compare these.</p>
<pre><code>sage: polygon([(0,0), (1,1), (0,1)],alpha=.1).save('test.pdf')
sage: polygon([(0,0), (1,1), (0,1)],alpha=.1).save('test.eps')
</code></pre>
<p>If I can narrow it down a little more, I'll open a ticket. It's conceivable that it's a matplotlib issue, but I'd guess it's ours first.</p>
https://ask.sagemath.org/question/9779/no-fillalpha-after-eps-export/?comment=18275#post-id-18275That is not correct. eps supports alpha channels. Here's proof: http://ompldr.org/vaGViZg/drawing.eps
Ok. It is not so clear whether ps really really supports alpha. Some libraries use some tricks to get in some alpha support.Fri, 08 Feb 2013 10:34:04 +0100https://ask.sagemath.org/question/9779/no-fillalpha-after-eps-export/?comment=18275#post-id-18275Answer by fidbc for <p>Hey guys,</p>
<p>this is a slightly modified example from the sage help pages:</p>
<p>(plot(1+e^(-x^2), xmin=-2, xmax=2, ymin=0, ymax=2.5, fill=0.5, fillcolor='green', fillalpha=0.5)).save('t.eps')</p>
<p>It shows an exponential function which is filled from below by green color. The option fillalpha=0.5 should make this filling slightly transparent, which works perfectly when exporting to pdf, but repdroducably fails when exporting to eps. Is there any workaround?</p>
https://ask.sagemath.org/question/9779/no-fillalpha-after-eps-export/?answer=14521#post-id-14521Hi,
Not really a `sage` solution and far from optimal. You can try
sage: P=plot(1+e^(-x^2), xmin=-2, xmax=2, ymin=0, ymax=2.5, fill=0.5, fillcolor='green', fillalpha=0.5)
sage: P.save( 't.pdf')
And then
$ pdftops t.pdf
$ ps2eps t.ps
Wed, 06 Feb 2013 17:30:33 +0100https://ask.sagemath.org/question/9779/no-fillalpha-after-eps-export/?answer=14521#post-id-14521Comment by ppurka for <p>Hi,</p>
<p>Not really a <code>sage</code> solution and far from optimal. You can try</p>
<pre><code>sage: P=plot(1+e^(-x^2), xmin=-2, xmax=2, ymin=0, ymax=2.5, fill=0.5, fillcolor='green', fillalpha=0.5)
sage: P.save( 't.pdf')
</code></pre>
<p>And then </p>
<pre><code>$ pdftops t.pdf
$ ps2eps t.ps
</code></pre>
https://ask.sagemath.org/question/9779/no-fillalpha-after-eps-export/?comment=18263#post-id-18263Long story short, (e)ps does not properly support alpha. So, this is probably the best solution at present. There is no automatic way to make figures with alpha in (e)ps.Sat, 09 Feb 2013 10:02:14 +0100https://ask.sagemath.org/question/9779/no-fillalpha-after-eps-export/?comment=18263#post-id-18263