Visualization and Graphics Part2b
Visualization and Graphics Part2b
To Select a Tool:
Do one of the following:
Persistence of Tools
Do one of the following:
Tools
Selection Tool
You can use the Selection tool to select a graphics primitive as a whole.
For more information on how to use the Selection tool, see "Interactive Graphics: Selecting".
Click the Draw Arrow tool and drag the pointer ( ) to draw an arrow.
Hold down the Shift key to draw the arrow horizontally or vertically.
Visualization and Graphics 121
Click the Draw Freehand tool button and drag the pointer ( ) to draw a curve.
Click the Draw Line tool and drag the pointer ( ) to draw a single line.
You can set line styles with the Graphics Inspector palette.
Click the Draw Line Segments tool and drag the pointer ( ) to draw a multi-segment
line.
You can set the line style with the Graphics Inspector palette.
Visualization and Graphics 123
Click the Draw Point tool and then click to draw a point.
You can place text in a graphic with the Place Text tool.
1.0
Sine Curve
0.5
1 2 3 4 5 6
-0.5
-1.0
124 Visualization and Graphics
You can place TraditionalForm text in a graphic with the Place TraditionalForm Text
tool.
1.0
y = SinHxL
0.5
1 2 3 4 5 6
-0.5
-1.0
Click the Draw Rectangle tool and drag the pointer ( ) to draw a rectangle.
You can set face and edge styles with the Graphics Inspector palette.
Visualization and Graphics 125
Click the Draw Polygon tool and drag the pointer ( ) to draw a polygon.
You can set face and edge styles with the Graphics Inspector palette.
Click the Draw Circle tool and drag the pointer ( ) to draw a circle, ellipse, or disk.
You can draw both filled and unfilled circles, depending on the currently selected fill and edge
attributes.
Graphics Inspector
Click the Graphics Inspector button to display the Graphics Inspector palette.
The Graphics Inspector palette lets you interactively set the style of a graphics object.
Visualization and Graphics 127
Click the Get Coordinates tool and move the mouse pointer ( ) over a 2D graphic or a
2D plot. The approximate coordinate values of the mouse position are displayed.
Click to mark the coordinates. Click at other positions to add markers. You can delete markers
with Command +click.
Use Command +C to copy the marked coordinates to the clipboard. Use Command +V to paste
the copied coordinate values into an input cell.
881.89, 1.792<, 80.7403, 0.8351<, 8- 0.6706, 0.7132<<
Use Alt +drag to mark a rectangle and Command +C to copy the coordinates of the opposite
corners.
128 Visualization and Graphics
Drag to mark a coordinate path, then type Command +C to copy the coordinates.
Selecting an Object
To begin editing within a graphic, double-click the background or an object in the graphic. The
frame highlight is dashed.
Visualization and Graphics 129
When over a handle, the arrow cursor ( ) changes to the double arrow cursor ( , ,
, or ).
130 Visualization and Graphics
To resize a disk without changing its shape, press Shift and drag a handle.
Shift+click to select another disk. The two disks with crosshairs (+) at their centers are
selected.
In another graphic, double-click the background and paste. The rectangle will be at its original
coordinates.
Paste the copied rectangle again. The disk disappears and a new copy of the rectangle appears
once again at its original coordinates.
Whether the rectangle appears above or below a disk depends on the position of the replaced
disk in the internal ordering of the graphics expression.
In contrast to double-clicking the background of the target graphic, a single click selects the
target as a whole.
Visualization and Graphics 135
Inset Objects
Here is a graphic with three squares. Click the graphic and copy it.
Paste the graphic copied before. The three squares will be pasted, replacing the selected square.
136 Visualization and Graphics
The pasted squares are in an Inset . Click the Inset to select it.
Copy the selected Inset , click the background of the graphic to deselect the Inset , and
paste. Move the pasted Inset to the upper right.
Visualization and Graphics 137
Pointers
Vertices and Circle Points
Line Segments
Primitives
Reshaping Overlapping Objects
Multiple Objects
Pointers
The following sequence explains how to use the Reshape tool ( , , and ).
Double-click the background and press the r key to make the Reshape tool ( ) appear.
Move the pointer over a filled rectangle~the subscript on the pointer is a pair of double arrows
( ) indicating that the rectangle can be dragged.
Visualization and Graphics 139
Move the pointer over a vertex~the subscript on the pointer is a small circle ( ).
Move the pointer over a line segment~the subscript on the pointer is a small line ( ).
Double-click the background and press the r key to make the Reshape Tool ( ) appear.
Visualization and Graphics 141
Move the pointer over a vertex~the subscript on the pointer is a small circle ( ). Click to
select the vertex. The other vertices are shown but are not selected.
Drag the center or the top-right corner point of a Circle or Disk primitive to reshape it.
Line Segments
The following sequence shows where the line segments of graphics primitives are located and
how to select them.
Double-click the background and press the r key to make the Reshape Tool ( ) appear.
Visualization and Graphics 143
Move the pointer over a line segment~the subscript on the pointer is a small line ( ). Click
Double-click a line segment to select all the line segments of the polygon.
Circle, Disk, and Rectangle primitives do not have selectable line segments.
Primitives
Reshaping a Rectangle
The following sequence shows how to reshape a Rectangle primitive.
Double-click the background and press the r key to make the Reshape Tool ( ) appear.
Visualization and Graphics 145
Reshaping a Disk
The following sequence shows how to reshape a Disk primitive.
Double-click the background and press the r key to make the Reshape Tool ( ) appear.
146 Visualization and Graphics
Click the center point of a disk. You can now see the top-right corner point.
Drag the center point. This keeps the top-right corner point fixed in the same place but changes
the shape of the disk.
Click the top-right corner point to select it. This deselects the center point.
Visualization and Graphics 147
Drag the top-right corner point to change the radius of the disk. The center does not change.
Reshaping a Polygon
The following sequence shows how to reshape the lower polygon to fit the upper polygon.
Double-click the background and press the r key to make the Reshape Tool ( ) appear.
Drag either B or C.
Visualization and Graphics 149
Reshaping Lines
The following sequence shows how to reshape the line below to a zigzag pattern.
Double-click the background and press the r key to make the Reshape Tool ( ) appear.
Click the line segment l and Shift+click the line segments m and n.
Drag one of the selected line segments to move them all simultaneously.
154 Visualization and Graphics
Drag one of the selected line segments or E to move them all simultaneously.
Visualization and Graphics 155
There are four hidden rectangles underneath the disk in the middle. Double-click the back-
ground and press the r key to make the Reshape Tool ( ) appear.
To select one of the hidden rectangles, click the background and drag across the disk.
To select the whole rectangle, you may need to start from a new position.
To reshape the selected hidden rectangle, first Shift+click a corner to deselect the vertex.
Multiple Objects
Double-click the background and press the r key to make the Reshape Tool ( ) appear.
Visualization and Graphics 157
Drag one of the selected vertices. All of the selected rectangles will be reshaped simultaneously.
158 Visualization and Graphics
Double-click the background and press the r key to make the Reshape Tool ( ) appear.
Drag any one of the selected segments to simultaneously reshape the three Line primitives.
Double-click the background and press the r key to make the Reshape Tool ( ) appear.
Click the background and drag across all the line segments and vertices around the gap in the
middle.
160 Visualization and Graphics
Drag one of the selected line segments or vertices to simultaneously reshape the whole picture.
Cropping
The following sequence shows how to crop a portion of a plot.
Setting Margins
The following sequence shows how to set the margins of a graphic.
1.0
0.5
-6 -4 -2 2 4 6
-0.5
-1.0
1.0
0.5
-6 -4 -2 2 4 6
-0.5
-1.0
Visualization and Graphics 163
To get rid of the margins, Shift+drag the graphics frame to the top-left corner.
1.0
0.5
-6 -4 -2 2 4 6
-0.5
-1.0
Graphics as Input
An image is equivalent to its symbolic expression. You can operate on an image as you would
on a symbolic expression.
Out[1]=
Type êê InputForm after the graphic to get the symbolic expression that corresponds to the
graphic.
In[2]:= Graphics@Table@8RGBColor@i ê 2, .7, j ê 2D, Disk@82 i, 2 j<D<, 8i, 0, 2<, 8j, 0, 2<DD
In[3]:= êê InputForm
Type a Mathematica Replace command after the output graphic and evaluate.
Rotate
You can rotate 3D graphics with your mouse.