Message Boards Message Boards

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

Posted 10 years ago

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

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
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract