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.
{x, y}  twodimensional coordinates 
Scaled[{x, y}]  
Scaled[{dx, dy}, {x, y}]  
{x, y, z}  threedimensional coordinates 
Scaled[{x, y, z}]  
Scaled[{dx, dy, dz}, {x, y, z}] 
The coordinates for a primitive such as Line or Polygon can be given in a number of ways. The simplest and most obvious is to give pairs of numbers for twodimensional graphics and triples for threedimensional graphics. These are called user coordinates; they are the initial points which we wish to represent. An alternative way to represent points, in a particular part of the picture, is to use Scaled coordinates. These refer to display coordinates. For example, they allow us to draw something in the middle of the image without having to know anything about the user coordinates being displayed.
As an object is rendered the list of primitives and directives is scanned to determine the extent of the coordinates which are shown. This is controlled by the option PlotRange which provides considerable control of the range which will be seen.
PlotRange > Automatic  only the most interesting part 
PlotRange > All  the full range of coordinates 
PlotRange > {min, max}  the range from min to max 
This shows a plot with the default value PlotRange > Automatic.  In[1]:= plot = ParametricPlot3D[{x, Tan[x] Sin[1.5 x], Tan[x] Cos[1.5 x]},
{x, 0, 10}] 
Out[1]=  Graphics3D  

This shows the actual numbers which were used.  In[2]:= FullOptions[%, PlotRange] Out[2]= {{0.25, 10.25}, {3.81988, 3.13889}, {3.48307, 4.05394}} 
This plots all the primitives. Notice that this shows less about the function than the previous plot.  In[3]:= Show[plot, PlotRange > All] 
Out[3]=  Graphics3D  

This applies to the z direction only. The x and y PlotRange is determined by the default.  In[4]:= Show[plot, PlotRange > {2, 4}] 
Out[4]=  Graphics3D  

This works on all three dimensions.  In[5]:= Show[plot, PlotRange > {{0, Pi}, {4, 4}, {4, 4}}] 
Out[5]=  Graphics3D  
In general, a wide range of settings and combinations for the PlotRange option can be used.
PlotRange > {Automatic, All}  two dimensions 
PlotRange > {All, {5., 10.}}  two dimensions 
PlotRange > {Automatic, {3., 5.}, All}  three dimensions 
The examples of primitives which we have seen all showed the coordinates being given in one system, the original or user coordinate system. Sometimes you wish to choose points described in the final or display coordinate system. This is done with the Scaled command. Here I describe the threedimensional form. There is an equivalent twodimensional version.
{x, y, z}  {x, y, z} in user coordinates 
Scaled[{sx, sy, sz}]  {sx, sy, sz} in display coordinates 
Scaled[{dx, dy, dz}, {x, y, z}]  {dx, dy, dz} in display coordinates relative to {x, y, z} in user coordinates 
Scaled coordinates are chosen to run from 0 to 1 in all three dimensions and have their origin at the corner of the bounding box with the minimal user coordinates. Thus Scaled[{0, 0, 0}] refers to the minimum of the PlotRange and Scaled[{1, 1, 1}] to the maximum.
This always draws lines from corner to corner of the bounding box.  In[6]:= Show[Graphics3D[{Line[{Scaled[{0, 0, 0}], Scaled[{1, 1, 1}]}],
Line[{Scaled[{0, 0, 1}], Scaled[{1, 1, 0}]}], Line[{Scaled[{1, 0, 0}], Scaled[{0, 1, 1}]}],
Line[{Scaled[{1, 0, 1}], Scaled[{0, 1, 0}]}]}]] 
Out[6]=  Graphics3D  

This is a Mathematica function which uses the offset version of Scaled.  In[7]:= cross[{x_, y_, z_}] :=
{Line[{Scaled[{0.02, 0, 0}, {x, y, z}], Scaled[{+0.02, 0, 0}, {x, y, z}]}],
Line[{Scaled[{0, 0.02, 0}, {x, y, z}], Scaled[{0, +0.02, 0}, {x, y, z}]}],
Line[{Scaled[{0, 0, 0.02}, {x, y, z}], Scaled[{0, 0, +0.02}, {x, y, z}]}]}

In[8]:= Show[Graphics3D[{cross[{0, 0, 0}], cross[{1, 1, 0.5}],
cross[{0.5, 0.5, 1}]}]] 

Out[8]=  Graphics3D  
The aspect ratio of the graphics object is set by the option AspectRatio.
AspectRatio > num  show picture with a height / width = num 
AspectRatio > Automatic  show picture with ratio taken from data 
Even though AspectRatio > Automatic maintains the x to y scaling, this is often not very useful. An example is Plot[Tan[x], {x, 0, 2 Pi}, AspectRatio > Automatic].
next page: 5.2 ThreeDimensional Coordinates  back to table of contents 