Ask Your Question
0

No fillalpha after eps export?

asked 2013-02-06 13:51:53 +0100

pinwheel gravatar image

updated 2015-01-14 10:36:53 +0100

FrédéricC gravatar image

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?

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
1

answered 2013-02-06 17:30:33 +0100

fidbc gravatar image

Hi,

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
edit flag offensive delete link more

Comments

Long 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.

ppurka gravatar imageppurka ( 2013-02-09 10:02:14 +0100 )edit
0

answered 2013-02-06 20:54:45 +0100

kcrisman gravatar image

The 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.

edit flag offensive delete link more

Comments

See 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.

kcrisman gravatar imagekcrisman ( 2013-02-06 21:11:59 +0100 )edit

I have updated the ticket after opening an upstream mpl bug https://github.com/matplotlib/matplotlib/issues/1740

ppurka gravatar imageppurka ( 2013-02-08 04:11:36 +0100 )edit

And now matplotlib says this is actually not supported by ps.

kcrisman gravatar imagekcrisman ( 2013-02-08 10:02:17 +0100 )edit

That 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.

ppurka gravatar imageppurka ( 2013-02-08 10:34:04 +0100 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2013-02-06 13:51:53 +0100

Seen: 363 times

Last updated: Feb 06 '13