This HTML document is based on Mathematica Graphics: An Intensive Tutorial by Tom WickhamJones. It was adapted by Martin Kraus for noncommercial use.
Mathematica and MathLink are registered trademarks, and MathReader, MathSource and 3Script are trademarks of Wolfram Research, Inc.
All other product names mentioned are trademarks of their producers.
Copyright 1992 by Wolfram Research, Inc.
All rights reserved. No part of this document may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means, electronic, mechanical, photocopying, recording or otherwise, without the prior written permission of the copyright holder.
There are a number of ways to combine and convert images which are possible.
Prolog, Epilog  include Graphics primitives 
Plot, ParametricPlot, ParametricPlot3D  combine plots of several functions 
Graphics3D[ obj ]  convert to Graphics3D object 
Graphics[ obj ]  convert to Graphics object 
Show[ obj1 , obj2 , ... ]  convert and combine several objects 
The function plotting commands Plot, ParametricPlot and ParametricPlot3D all allow more than one function to be plotted.
The Evaluate command is necessary since ParametricPlot3D is HoldAll.  In[30]:= ParametricPlot3D[Evaluate[Table[{Cos[x], Sin[x],
n x}, {n, 5}]], {x, 0, 2 Pi}, BoxRatios > {1, 1, 1}] 
Out[30]=  Graphics3D  
To combine existing images we can just use Show.  In[31]:= Graphics3D[Line[{{0, 0, 0}, {0, 0, 40}}]] Out[31]=  Graphics3D  
In[32]:= Show[%%, %] 

Out[32]=  Graphics3D  
There are also methods to convert graphics of one type to another. One of the most common is the conversion of SurfaceGraphics to Graphics3D. This is useful since Graphics3D primitives can intersect and generally represent more complex shapes than SurfaceGraphics.
This makes a SurfaceGraphics object.  In[33]:= plot1 = Plot3D[x^2  y^2, {x, 1, 1}, {y, 1, 1}, BoxRatios > {1, 1, 2},
PlotPoints > 10, DisplayFunction > Identity] Out[33]=  SurfaceGraphics  
This converts it to Graphics3D.  In[34]:= Show[Graphics3D[plot1],
DisplayFunction > $DisplayFunction] 
Out[34]=  Graphics3D  

This makes another SurfaceGraphics object.  In[35]:= plot2 = Plot3D[y^2  x^2, {x, 1, 1}, {y, 1, 1}, BoxRatios > {1, 1, 2},
PlotPoints > 10, DisplayFunction > Identity] Out[35]=  SurfaceGraphics  
The convertion to Graphics3D happens automatically.  In[36]:= Show[plot1, plot2,
DisplayFunction > $DisplayFunction] 
Out[36]=  Graphics3D  
With this ability to combine objects one can build up complex pictures by making use of builtin commands to build individual components. It is always good to use the tools provided by a computer system as much as possible. As an example we will put a vector field on the surface of a sphere.
This generates a sphere. The setting of PlotPoints is crucial in this case.  In[37]:= sphere = ParametricPlot3D[{Cos[p] Sin[t], Sin[p] Sin[t],
Cos[t]}, {p, 0., 2 Pi}, {t, 0., Pi}, PlotPoints > {12 + 1, 8 + 1}, DisplayFunction > Identity] Out[37]=  Graphics3D  
This produces a list of pairs of starting points and corresponding vectors.  In[38]:= vecs = Flatten[Table[{{Cos[p] Sin[t], Sin[p] Sin[t], Cos[t]},
0.3 {Cos[p] Sin[t], Sin[p] Sin[t], Cos[t]} + {0.2, 0, 0}}, {p, 0., 2 Pi, 2 Pi / 12},
{t, 0., Pi, Pi / 8}], 1]; 
To show the vectors I will use the package Graphics`PlotField3D`.  In[39]:= <<Graphics`PlotField3D` 
This shows the list of vectors.  In[40]:= ListPlotVectorField3D[vecs] 
Out[40]=  Graphics3D  

Finally we can combine both images.  In[41]:= Show[%, sphere] 
Out[41]=  Graphics3D  
next page: 5 Coordinate Systems  back to table of contents 