Group Abstract Group Abstract

Message Boards Message Boards

How to create a plot by ContourPlot with the transparent background?

GROUPS:

I intend to overlap two plots produced by contourplot, and hope that at least the background of one plot is transparent so that the another plot behind it won't be blocked by it. Could anybody teach me how to do it? Thanks very much!

Jun Lin

POSTED BY: Jun Lin
Answer
4 months ago

Perhaps play with the ColorFunction option to the ContourPlots including an Opacity directive to allow the plot behind show through the one in front as in this (yes rather ugly, but it shows the approach):

cpl1 = ContourPlot[Cos[x] + Cos[y], {x, 0, 4 Pi}, {y, 0, 4 Pi}, 
ColorFunction -> (Directive[Opacity[.4], Hue[#]] &)]

cpl2 = ContourPlot[y Cos[x] + x Cos[y], {x, 0, 4 Pi}, {y, 0, 4 Pi},
ColorFunction -> (Directive[Opacity[.4], Hue[#]] &)]

Show[cpl1, cpl2]
POSTED BY: David Reiss
Answer
4 months ago