This is documentation for Mathematica 3, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)
 Documentation / Mathematica / Add-ons / Standard Packages / Introduction  /

Graphics and Geometry Packages

The Graphics packages offer log, polar, error, scatter, vector field, surface of revolution, three-dimensional contour, and implicit plots. Functions include maps for visualizing complex functions of complex numbers, and bar and pie charts for visualizing data. Mathematica's built-in graphics are enhanced by arrow, legend, and color directives, and by two-dimensional spline primitives and three-dimensional shape primitives. There are functions for the stellation and geodesation of regular polyhedra, animation of a sequence of graphics, and support for the 3-Script file format. The Geometry packages provide functions giving the characteristics of regular polygons and polyhedra and rotation in two and three dimensions.

  • This causes each Graphics package to be loaded as functions from the package are needed.
  • In[1]:= <<Graphics`

  • Here is a pie chart of the distribution of certain Mathematica users by field.
  • In[2]:= (styles = Map[Hue, Range[0, 10]/10 .7];
    ShowLegend[
    PieChart[ {29, 20, 16, 16, 5, 4, 3, 2, 1, 1, 4},
    PieStyle -> styles, PieLabels -> Join[
    {"Engineering", "Physical Sciences",
    "Computer Sciences", "Mathematical Sciences"},
    Table["", {7}]], DisplayFunction -> Identity],
    {Transpose[{Drop[styles, 4],
    {"Life Sciences", "Business Finance",
    "Administration", "Social Sciences",
    "Arts Humanities", "Technology", "Other"}
    }], LegendTextSpace -> 5, LegendPosition->{.5, -1},
    LegendShadow->{0, 0}}
    ])






  • This gives a histogram of the number of primes near four different values of . The bin widths are proportional to

    in each case.
  • In[3]:= (t = Map[ (w = 25 Log[#];
    Table[PrimePi[# + j w] - PrimePi[# + (j-1)w],
    {j, -3, 4}])&, 10^(1 + 2Range[4])];
    BarChart3D[t, XSpacing -> .8,
    Ticks -> {{{1, 10^3}, {2, 10^5}, {3, 10^7}, {4, 10^9}},
    None, Automatic}])




  • Here scattering cross section (

    ) is plotted versus the incident momentum of a particle beam (GeV/c), measured in a laboratory frame of reference. The estimated standard deviation of the cross section at each value of the incident momentum is indicated using error bars.
  • In[4]:= MultipleListPlot[
    Apply[{{#1, #2}, ErrorBar[#3]}&,
    { {4, 367, 17}, {6, 311, 9}, {8, 295, 9}, {10, 268, 7},
    {12, 253, 7}, {15, 239, 6}, {20, 220, 6}, {30, 213, 6},
    {75, 193, 5}, {150, 192, 5} }, 1],
    Frame -> True, SymbolShape -> PlotSymbol[Diamond, .5],
    FrameLabel -> {"incident momentum (GeV/c)",
    "cross section (\[Mu]b)"}]


  • Here is the Wolfcamp aquifer data again, this time displayed as a scatter plot.
  • In[5]:= (data = ReadList["wolfcamp.aquifer.data",
    Number, RecordLists->True];
    ScatterPlot3D[data, BoxRatios->{1, 1, .3}, Axes -> True,
    ViewPoint -> {1.3, 2.4, 2.}])


  • You can visualize the two-parameter gamma probability density function by creating a row of stacked graphics. A function having three parameters can be visualized using a two-dimensional array of stacked graphics.
  • In[6]:= (alphas = {.5, 1., 1.5, 2.};
    betas = {1, 2, 4};
    stacks = MapThread[Append[StackGraphics[#1],
    PlotLabel -> "\[Beta] = "<>ToString[#2]]&,
    {Apply[Plot[Evaluate[PDF[GammaDistribution[#2, #1], x]],
    {x, $MachineEpsilon, 4}, DisplayFunction -> Identity]&,
    Outer[List, betas, alphas], {2}], betas} ];
    Show[GraphicsArray[stacks], PlotLabel ->
    "gamma distribution for \[Alpha] = .5, 1, 1.5, 2"])


  • This initializes the Geometry packages.
  • In[7]:= <<Geometry`

  • Here the regular polyhedra are plotted according to number of faces, number of edges, and volume when edges have unit length.
  • In[8]:= Apply[Show,
    Join[
    Map[Polyhedron[#, {NumberOfFaces[#], NumberOfEdges[#],
    Volume[#]}, .7]&,
    {Tetrahedron, Cube, Octahedron, Dodecahedron,
    Icosahedron}],
    {Axes -> True, AxesLabel -> {"# of faces", "# of edges",
    "volume"},
    Ticks -> {{4, 6, 8, 12, 20}, {6, 12, 12, 30, 30},
    Automatic}}] ]