|
From: Michael D. <md...@st...> - 2012-06-20 18:24:47
|
The postscript output of the Cairo backend supports transparency
emulation, though it hasn't been tested in some time. Eric's suggestion
(to output PDF and then convert to EPS) is also a reasonable one.
Mike
On 06/20/2012 10:38 AM, Francesco Montesano wrote:
> Dear list,
>
> it might be that this is not the best place to ask, but I guess that
> there are enough people with experience with colors.
>
> I think plots with nice colors and shaded areas are very nice, but for
> my publication I have to use eps files, that do not support
> transparency.
> The script below produce a figure like the one that I would like to
> make. If I save it as eps all the shaded areas are not transparent and
> the plot look ugly and unreadable.
>
> A way to emulate transparency that I've applied some time ago was to
> get the RGB value of the transparent color (with DigitalColor Meter on
> Mac) and to insert it by hand in fill_between, with a low value for
> the zorder option. The results was fine, but I don't like too much
> this approach, as any change in color or alpha value would require to
> go, get the new color, insert it and redo the figure.
>
> Is anyone aware of a way to obtain automatically a RGB color that on
> screen or printed looks similar to the corresponding RGBA?
>
> Thanks in advance,
> Francesco
>
> ********Sample code*********
>
> "plot with errors done with fill_between. Emulation of alpha in eps"
>
> import itertools as it
> import matplotlib.pyplot as plt
> import numpy as np
>
> col = it.cycle([ 'm', 'r', 'g', 'b', 'c', 'y', 'k', ])
> ls = it.cycle( [ '-', '--', '-.', ':' ][::-1])
>
> #figure
> fig = plt.figure()
> ax = fig.add_subplot(111)
>
> x= np.linspace(0.5,5,100)
> for i in range(3):
> c = col.next()
> l = ls.next()
> ax.plot( x, np.sin(x)**i, color=c, ls=l,
> label='$sin^{0}(x)$'.format(i), zorder=10+i )
> ax.fill_between( x, np.sin(x)**i + 1./x, np.sin(x)**i - 1./x,
> color=c, linestyle=l, alpha=0.5, zorder=i+1)
>
> ax.legend(frameon=False)
>
> plt.savefig("test_alpha.pdf")
> plt.savefig("test_alpha.eps")
> plt.show()
>
> exit()
> ********End sample code*********
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
|