用于覆盖图的不透明度控制

Pla*_*iac 5 graphics wolfram-mathematica

给出两个矢量图和如下的等高线图

as = VectorPlot[{Cos[y], Sin[x] }, {x, -3, 3}, {y, -3, 3},
                 VectorScale -> Automatic, VectorColorFunction -> "Rainbow"
     ];
bs = StreamPlot[{Cos[y], Sin[x] }, {x, -3, 3}, {y, -3, 3},
                 VectorScale -> Automatic, StreamColorFunction -> "Rainbow"
     ];
cs = ContourPlot[Cos[x] + Sin[y], {x, -3, 3}, {y, -3, 3},
                 ColorFunction -> "BlueGreenYellow"
     ];
Show[cs, bs, as]
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

我们可以看到Show []完成了基本的叠加工作.但我的问题是如何控制背景轮廓图 cs 的不透明度?另外,如何在颜色函数中插入"BlueGreenYellow"类型的颜色方案,如下所示?

ContourPlot[Cos[x] + Sin[y], {x, -3, 3}, {y, -3, 3},
            ColorFunction -> (Directive[Opacity[#],Blue] &)
];
Run Code Online (Sandbox Code Playgroud)

Mr.*_*ard 11

我不相信jmlopez'解决方案是正确的,因为矢量和帧也是部分透明的.我相信最好OpacityGraphics对象中插入一个命令,这将保留不透明的向量:

as = VectorPlot[{Cos[y], Sin[x]}, {x, -3, 3}, {y, -3, 3}, 
       VectorScale -> Automatic, VectorColorFunction -> "Rainbow"];
bs = StreamPlot[{Cos[y], Sin[x]}, {x, -3, 3}, {y, -3, 3}, 
       VectorScale -> Automatic, StreamColorFunction -> "Rainbow"];
cs = ContourPlot[Cos[x] + Sin[y], {x, -3, 3}, {y, -3, 3}, 
       ColorFunction -> "BlueGreenYellow"];

cs2 = MapAt[{Opacity[0.5], #} &, cs, 1];

Show[cs2, bs, as]
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述


第二个问题从未得到解决.您可以组合不透明度和颜色渐变,如下所示:

ContourPlot[Cos[x] + Sin[y], {x, -3, 3}, {y, -3, 3}, 
  ColorFunction -> ({Opacity[#], ColorData["BlueGreenYellow"][#]} &)
]
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述


jml*_*pez 7

您可以尝试使用BaseStyle如下:

cs = ContourPlot[Cos[x] + Sin[y], {x, -3, 3}, {y, -3, 3}, 
                 ColorFunction -> "BlueGreenYellow", 
                 BaseStyle -> Directive[Opacity[0.5]]
     ];
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述