0% found this document useful (0 votes)
5 views

Visualization and Graphics Part2b

Uploaded by

publicacc71
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Visualization and Graphics Part2b

Uploaded by

publicacc71
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 48

Visualization and Graphics 119

To Select a Tool:
Do one of the following:

† Click a tool icon on the palette.

† With a graphic selected, type one of these letters:


o, p, f, l, s, a, g, c, q, m, t

Persistence of Tools
Do one of the following:

† Click a tool button to use a tool once.


After the single use, the tool will automatically revert to the Selection tool.

† Double-click a tool button to keep using the tool.

Tools

New Graphic Tool

Do one of the following:

† Type Command +1.

† Click the New Graphic button on the palette.

† Choose Graphics  New Graphic.

A blank drawing area with a bounding box appears.


120 Visualization and Graphics

Selection Tool

You can use the Selection tool to select a graphics primitive as a whole.

The selection is indicated by a frame with handles.

You can scale the selection by dragging a handle.

To scale equally in both directions, Shift+drag a handle.

You can move an object by dragging it.

You can remove or add an object to a selection with Shift+click.

Drag out a rectangle to select all the objects within it.

When an object is completely underneath another one, dragging makes it visible.

You can then drag it by dragging its highlight.

For more information on how to use the Selection tool, see "Interactive Graphics: Selecting".

Draw Arrow Tool

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

Draw Freehand Tool

Click the Draw Freehand tool button and drag the pointer ( ) to draw a curve.

Double-click the Draw Freehand tool to draw multiple curves.

Draw Line Tool

Click the Draw Line tool and drag the pointer ( ) to draw a single line.

Hold down the Shift key to draw a horizontal or vertical line.


122 Visualization and Graphics

You can set line styles with the Graphics Inspector palette.

Draw Line Segments Tool

Click the Draw Line Segments tool and drag the pointer ( ) to draw a multi-segment

line.

You get a new segment after each click.

To stop, double-click the last point or single-click the first point.

You can set the line style with the Graphics Inspector palette.
Visualization and Graphics 123

Draw Point Tool

Click the Draw Point tool and then click to draw a point.

You can set point styles with the Graphics Inspector.

Place Text Tool

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

Place TraditionalForm Text Tool

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

Draw Rectangle Tool

Click the Draw Rectangle tool and drag the pointer ( ) to draw a rectangle.

Hold down the Shift key to draw squares.

You can set face and edge styles with the Graphics Inspector palette.
Visualization and Graphics 125

Draw Polygon Tool

Click the Draw Polygon tool and drag the pointer ( ) to draw a polygon.

You get a new segment after each click.

To stop, double-click the last point or single-click the first point.

You can set face and edge styles with the Graphics Inspector palette.

Draw Circle Tool

Click the Draw Circle tool and drag the pointer ( ) to draw a circle, ellipse, or disk.

Hold down the Shift key to draw circles.


126 Visualization and Graphics

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

Get Coordinates Tool

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

Use Command +V to paste.


888- 0.2292, 0.2501<, 80.4628, 1.452<<<

Drag to mark a coordinate path, then type Command +C to copy the coordinates.

Paste the coordinates into an input cell.


880.1222, 0.3444<, 80.1417, 0.3722<, 80.1694, 0.4083<,
80.2167, 0.4444<, 80.2694, 0.475<, 80.3417, 0.5056<, 80.4139, 0.5139<,
80.45, 0.5139<, 80.4833, 0.5083<, 80.5194, 0.4917<, 80.5361, 0.4722<,
80.5472, 0.4583<, 80.5583, 0.4444<, 80.5611, 0.4278<, 80.5611, 0.4111<,
80.5611, 0.3972<, 80.5611, 0.3861<, 80.5528, 0.3806<, 80.5417, 0.3694<,
80.5194, 0.3611<, 80.4972, 0.3556<, 80.4722, 0.3556<, 80.45, 0.3611<,
80.4194, 0.3778<, 80.4028, 0.3972<, 80.3944, 0.4167<, 80.3944, 0.4333<,
80.3917, 0.4528<, 80.3917, 0.4722<, 80.3972, 0.4889<, 80.4111, 0.5083<,
80.425, 0.5333<, 80.4528, 0.5667<, 80.4861, 0.5917<, 80.525, 0.6222<,
80.5833, 0.6528<, 80.6444, 0.6778<, 80.675, 0.6861<, 80.6861, 0.6889<<

Selecting Graphics Objects

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

Click a disk to select it.

Drag the disk or its frame highlight to move it.

When over a handle, the arrow cursor ( ) changes to the double arrow cursor ( , ,

, or ).
130 Visualization and Graphics

Drag a handle to reshape the selected disk.

To resize a disk without changing its shape, press Shift and drag a handle.

Selecting Multiple Objects

Click a disk to select it.


Visualization and Graphics 131

Shift+click to select another disk. The two disks with crosshairs (+) at their centers are
selected.

Drag a handle to stretch the selected disks.

Click outside the selected disks to deselect.


132 Visualization and Graphics

Click and drag across some disks to select them.

Shift+click to deselect a selected disk.

Shift+drag to deselect a group of disks.


Visualization and Graphics 133

Copy and Paste


The following sequence shows how to copy and paste an object from one graphic to another.

Click to copy a rectangle.

In another graphic, double-click the background and paste. The rectangle will be at its original
coordinates.

Drag the pasted rectangle to move it out of the way.


134 Visualization and Graphics

Click a disk to select it.

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

Pasting now replaces the whole graphic.

Inset Objects

Here is a graphic with three squares. Click the graphic and copy it.

Double-click a square to select 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.

To move the Inset , click anywhere inside it and drag.

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

Double-click an object in an Inset to select it.

Click and drag an object in an Inset to move it.

Objects in different Inset groups cannot be selected simultaneously.


138 Visualization and Graphics

Reshaping Graphics Objects


In this tutorial, the following topics are discussed:

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

You can now drag the rectangle.

Move the pointer over a vertex~the subscript on the pointer is a small circle ( ).

Now you can drag the vertex to reshape the line.


140 Visualization and Graphics

Move the pointer over a line segment~the subscript on the pointer is a small line ( ).

You can drag the line segment to reshape the line.

Rectangle primitives do not have selectable line segments.

Vertices and Circle Points


The following sequence shows where the selectable points 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 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.

Shift+click another vertex to add it to the selection.

Shift+click a selected vertex to deselect it.


142 Visualization and Graphics

Drag the center or the top-right corner point of a Circle or Disk primitive to reshape it.

The two vertices of a Rectangle primitive are at opposite corners.

Polygon and Line primitives have vertices at every corner.

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

to select the line segment.

Shift+click another line segment to add it to the selection.

Shift+click a selected line segment to deselect it.


144 Visualization and Graphics

Double-click a line segment to select all the line segments of the polygon.

Polygon and Line primitives have line segments on their sides.

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

Rectangles have vertices at opposite corners.

Click a vertex to select it.

Drag the selected vertex to reshape the Rectangle.

Rectangle primitives do not have line segments that can be selected.

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.

Click the vertex A.


148 Visualization and Graphics

Drag the vertex A to reshape the polygon.

Click the vertex B and Shift+click the vertex C.

Drag either B or C.
Visualization and Graphics 149

Click the line segment k to select it.

Drag k to reshape the polygon.

Click the line segment l and Shift+click the line segment m.


150 Visualization and Graphics

Drag either l or m to move them both together.

Click the line segment n and Shift+click the vertex D.

Drag either n or D to move them both together.


Visualization and Graphics 151

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 vertex A.

Drag A to reshape the line.


152 Visualization and Graphics

Click the vertex B and Shift+click the vertices C and D.

Drag one of the selected vertices.

Click the line segment k to select it.


Visualization and Graphics 153

Drag k to reshape the line.

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

Shift+click the vertex E to add it to the selection.

Drag one of the selected line segments or E to move them all simultaneously.
Visualization and Graphics 155

Reshaping Overlapping Objects


The following sequence shows how to reshape a hidden object.

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.

You can move the rectangle by dragging its highlight.


156 Visualization and Graphics

To reshape the selected hidden rectangle, first Shift+click a corner to deselect the vertex.

Then drag the other vertex.

Multiple Objects

Reshaping Multiple Rectangles


The following sequence shows how to reshape a set of rectangles simultaneously.

Double-click the background and press the r key to make the Reshape Tool ( ) appear.
Visualization and Graphics 157

Click one of the two vertices of a rectangle.

Shift+click some vertices in the other rectangles.

Drag one of the selected vertices. All of the selected rectangles will be reshaped simultaneously.
158 Visualization and Graphics

Reshaping Multiple Lines


The following sequence shows how to reshape three lines simultaneously.

Double-click the background and press the r key to make the Reshape Tool ( ) appear.

Click a segment of one of the Line primitives.

Shift+click segments in other Line primitives.


Visualization and Graphics 159

Drag any one of the selected segments to simultaneously reshape the three Line primitives.

Reshaping with Vertices and Line Segments


The following sequence shows how to reshape with different kinds of objects.

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.

Resizing, Cropping, and Adding Margins to Graphics

Changing the AspectRatio


The following sequence shows how to change the aspect ratio of a plot.

Using the Selection tool, click to select the graphic.


Plot@Cos@xD + 1 ê 2, 8x, 0, 3 Pi<D

Shift+drag a handle to change the aspect ratio.


Visualization and Graphics 161

Cropping
The following sequence shows how to crop a portion of a plot.

Using the Selection tool, click a graphic to select it.


Plot@ChebyshevU@6, xD, 8x, - 1, 1<D

Command +drag a handle to crop the plot.

Setting Margins
The following sequence shows how to set the margins of a graphic.

Click to select the graphic.


162 Visualization and Graphics

Drag the frame (not a handle) to push out the margins.

1.0
0.5

-6 -4 -2 2 4 6
-0.5
-1.0

To change a margin directly, drag a margin frame handle.

To keep the margins equal, Shift+drag the frame.

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.

This input produces some disks.


In[1]:= Graphics@Table@8RGBColor@i ê 2, .7, j ê 2D, Disk@82 i, 2 j<D<, 8i, 0, 2<, 8j, 0, 2<DD

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

Out[3]//InputForm= Graphics[{{{RGBColor[0, 0.7, 0], Disk[{0, 0}]}, {RGBColor[0, 0.7, 1/2],


Disk[{0, 2}]}, {RGBColor[0, 0.7, 1], Disk[{0, 4}]}},
{{RGBColor[1/2, 0.7, 0], Disk[{2, 0}]}, {RGBColor[1/2, 0.7, 1/2],
Disk[{2, 2}]}, {RGBColor[1/2, 0.7, 1], Disk[{2, 4}]}},
{{RGBColor[1, 0.7, 0], Disk[{4, 0}]}, {RGBColor[1, 0.7, 1/2], Disk[{4, 2}]},
{RGBColor[1, 0.7, 1], Disk[{4, 4}]}}}]
164 Visualization and Graphics

Type a Mathematica Replace command after the output graphic and evaluate.

In[4]:= ê. Disk Ø Rectangle

The disks are now replaced by squares.


Out[5]=

Interacting with 3D Graphics

Rotate
You can rotate 3D graphics with your mouse.

Move the pointer over the 3D graphic.

The pointer changes to the 3D rotate pointer .

Drag to rotate the graphic.


Visualization and Graphics 165

Rotate about the Axis Perpendicular to the Screen


You can also rotate 3D objects about the axis perpendicular to the screen with your mouse.

Move the pointer to a corner of the display area of the 3D graphic.

The pointer changes to the 3D vertical rotate pointer .

Click and move the pointer clockwise or counterclockwise.

Zoom In and Out with Command


You can zoom in and out of 3D graphics.

Press Command and move the pointer over the 3D graphic.

The pointer changes to the 3D zoom pointer .

Drag up to zoom in and down to zoom out.


166 Visualization and Graphics

Pan with Shift


You can pan 3D graphics across the screen.

Press Shift and move the pointer over the 3D graphic.

The pointer changes to the 3D pan pointer .

Drag to move the graphic.

You might also like