此为 Mathematica 7 文档,内容基于更早版本的 Wolfram 语言
查看最新文档(版本11.1)
Mathematica HowTo
How to | Add Transparency to Plots
Transparency is useful in plots when you need an unobstructed view of multiple components of one plot, or simply want to lighten a single plot component against a white background. Mathematica uses the graphics directive Opacity to apply transparency to graphics objects. Opacity can be used with most visualization functions.
Here is a 2D plot:
In[1]:=
Click for copyable input
Out[1]=
Use the PlotStyle option with Opacity to make the plot 70% transparent:
In[2]:=
Click for copyable input
Out[2]=
Here is a 3D plot:
In[3]:=
Click for copyable input
Out[3]=
Make the plot 60% transparent:
In[4]:=
Click for copyable input
Out[4]=
Add different transparency settings for plots of multiple functions:
In[5]:=
Click for copyable input
Out[5]=
Here is a 2D region determined by two inequalities:
In[6]:=
Click for copyable input
Out[6]=
Make the plot 50% transparent:
In[7]:=
Click for copyable input
Out[7]=
    
Use Opacity to see the inner parts of a plot:
In[8]:=
Click for copyable input
Out[8]=
Use the ContourStyle option of ContourPlot3D with Opacity:
In[9]:=
Click for copyable input
Out[9]=
    
You can also add transparency to graphics.
Make a 75% transparent disk:
In[10]:=
Click for copyable input
Out[10]=
Opacity can have values between 0 and 1, with 0 corresponding to perfect transparency:
In[11]:=
Click for copyable input
Out[11]=
Use Opacity with a color:
In[12]:=
Click for copyable input
Out[12]=
    
Opacity interacts well with other Mathematica functions: