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*********