好的,所以 EPS 不能支持真正的透明度/不透明度 - 但这并不意味着 Mathematica 7 可以原谅做如此糟糕的工作。正如我的 Mathematica 8 所证明的那样,可以让它看起来更好。
Mathematica 7 输出的问题在于,当您真正想要较浅的颜色时,它使用与曲线相同的颜色进行填充。EPS 是一种纯文本格式,因此编写一个快速的 hack 非常容易。这是关于PS图形的快速教程。
在 PS 图形中,你定义一个路径,然后你说你想要它是描边(线条)还是填充(区域)——或者其他我们不需要担心的事情。颜色被设置并保持在那里,直到它们被重置。所以我简单的导入Mma7生成的EPS,找到所有填充的路径。对于每个填充路径,您可以找到以前的颜色并将填充命令上方的颜色重置为更亮的颜色。
所以这是一个例子(我没有费心将它打包成一个脚本/模块)。所有输出均来自 Mathematica 7.0.1
p = Plot[Evaluate[Table[BesselJ[n, x], {n, 4}]], {x, 0, 10}, Filling -> Axis]

使用 . 导出到 EPS 文件Export["BesselJs7.eps", p]
。这会产生一个可怕的图形

好的,现在“修复”
pList = Import["BesselJs7.eps", "List"]; (* Import image as a list of strings *)
FList = Flatten@Position[pList, "F"]; (* find all fill commands *)
请注意,EPS 文件有/F { fill} bind def
定义快捷方式的行F
。此外,您可以检查是否pList[[FList - 1]]
产生了"closepath"
s 列表。
FColorList = {}; (* get list of colors associated with fills *)
Catch[Do[
i = 0; rgb = True; newpath = True;
While[rgb || newpath,
(*Print[{f,i,f-i,rgb,newpath,pList[[f-i]]}];*)
If[rgb && StringMatchQ[pList[[f - i]], __ ~~ "r"], rgb = False;
AppendTo[FColorList, pList[[f - i]]]];
If[newpath && StringMatchQ[pList[[f - i]], "newpath" ~~ __],
newpath = False; np[f] = f - i];
If[f - i == 1, Throw[{f, rgb, newpath}]];
i++],
{f, FList}]]
现在创建新颜色的技巧 - 我所做的就是将 0.5 添加到每个 rgb 值。这绝对可以做得更好:
FColorListNew = Table[Most@ToExpression@StringSplit[f] + .5,
{f, FColorList}] /. _?(# > 1 &) -> 1.;
FColorListNew = Table[StringJoin[{Riffle[ToString /@ f, " "], " r"}],
{f, FColorListNew}];
最后,插入新颜色并将其写回:
Do[pList = Insert[pList, FColorListNew[[i]], np[FList[[i]]] + i],
{i, Length[FList]}]
Export["BesselJsFixed.eps", pList, "List"]

有些事情,比如寻找newpath
地点,是不必要的,整个事情可能会被整理好。但是我现在已经花了足够的时间了!