Scientific Visualization and Graphics with Mathematica
 

Scientific Visualization and Graphics with Mathematica

Maintained by Jeff Bryant

 
 
Intro 2D Graphics 3D Graphics Hybrid Graphics Animations


Mathematica Visualization and Graphics Hints

This page lists some Mathematica features I like to make use of in generating some of the visualizations you will find on this site. I often find that people often are unaware of these particular features and so I thought I would draw extra attention to them. These are by no means the only features I use, but are just some of my favorites. For more hints, be sure to download the notebooks associated with each example.

 
ColorFunction

Although I don't use the terribly often, it is necessary to use this option to simulate functionality that resembles texture mapping. Although there is no support for true texture mapping (not true in version 8!), with enough polygons, you can ColorFunction to define a mapping between a polygon's color and the colors in an imported image.

 
Export

This function is used in all cases to export the Mathematica generated frames to graphics files. Animations are often exported as animated GIFs using:
ConversionOptions->{"Loop"->True}.

 
LightSources

Personally, I find this option a requirement for all 3D graphics. Without it, 3D graphics just don't look real. Most often I use a single white light source such as:
LightSources->{{{1,1,1}, White}}.

In version 6 and later, this option is obsolete. The way to control lighting in version 6 and later is with the Lighting option.

 
PlotRegion

I find this useful for simulating a 2D zoom effect using the form:
{{-zoom, 1 + zoom}, {-zoom, 1 + zoom}}, where zoom ranges from 0 (for no zoom) and higher numbers for increased zoom.

 
ReplaceAll

I often use this to transform 2D coordinates into 3D coordinates such as the following transformation rule which transforms a set of 2D points into 3D points in a plane:
3dpts = 2dpts /. {x_?NumberQ, y_?NumberQ} -> {x, y, 0}

 
SurfaceColor

I use this widely with 3D graphics to give surfaces a reflective property, especially with the 3 argument form.

In version 6 and later, this directive is replaced with the Specularity directive. This directive, along with a separate color directive, gives the same functionality as the legacy SurfaceColor directive.

 
ViewPoint

Critical option for simulating an orbital view of 3D objects. I often use this as
ViewPoint -> {2 Cos[-t], 2 Sin[-t], 0} for orbiting an object around its "equator". In this case, t ranges from 0 to 2 Pi.