The Student's Introduction to MATHEMATICA: A Handbook for Precalculus, Calculus, and Linear Algebra

3.8: Combining Graphics

3.8 Combining Graphics

So you want to combine two or more graphics together as one? There are many possibilities here, so we ll address each in turn.

Superimposing Plots

It is often desirable to view two or more plots together. If you simply want to plot several functions on the same set of axes, enter a list containing these functions as the first argument to the Plot command and you ll have it:

 In[1]:= <b class="bold">Clear[f, g];</b><b class="bold">             f[x+] := 1 <span class="unicode">?</span> x;</b><b class="bold">             g[x_] := x</b><sup<b class="bold">2</b></sup><b class="bold">;</b> In[4]:= <b class="bold">Plot[{f[x], g[x], f[x] * g[x]}, {x, <span class="unicode">?</span>1, 1}]</b><span class="inlinemediaobject"><a NAME="IMG_191"> href="portalcontent.asp?bkid=31099&image_src=https://images.books24x7.com/bookimages/id_31099/fig115%5F01%5F0%2Ejpg&image_id=191&previd=IMG_191"> target="_parent"><img alt="Image from book"> border="0"> height="158"> id="IMG_191"> src="https://images.books24x7.com/bookimages/id_31099/fig115_01.jpg"> title="Click To expand"> width="290"></a></span>

On your monitor the three functions are given three distinct colors. To better distinguish between them, one may wrap the list of functions with the Tooltip command. When you mouseover any curve in the resulting plot, a tooltip will pop up displaying that function s expression. Note that the output in printed form is indistinguishable from the prior output, so this feature is only useful in a live session.

 In[5]:= <b class="bold">Plot[Tooltip[{f[x], g[x], f[x] * g[x]}], {x, <span class="unicode">?</span>1, 1}]</b><span class="inlinemediaobject"><a NAME="IMG_192"> href="portalcontent.asp?bkid=31099&image_src=https://images.books24x7.com/bookimages/id_31099/fig115%5F02%5F0%2Ejpg&image_id=192&previd=IMG_192"> target="_parent"><img alt="Image from book"> border="0"> height="158"> id="IMG_192"> src="https://images.books24x7.com/bookimages/id_31099/fig115_02.jpg"> title="Click To expand"> width="290"></a></span>

One may also use the PlotStyle option to change the appearance of...

UNLIMITED FREE
ACCESS
TO THE WORLD'S BEST IDEAS

SUBMIT
Already a GlobalSpec user? Log in.

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.

Customize Your GlobalSpec Experience

Category: Pressure Sensors
Finish!
Privacy Policy

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.