MathGroup Archive 2003

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: How do I make graphs of (easy) functions like those in textbooks?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg40444] Re: How do I make graphs of (easy) functions like those in textbooks?
  • From: Bill Rowe <listuser at earthlink.net>
  • Date: Sat, 5 Apr 2003 04:01:31 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

On 4/4/03 at 1:25 AM, a_cjones at hotmail.com (cdj) wrote:

>Take, for example, f(x)= (x-3)^2 - 1

>I'd greatly appreciate seeing the Mathematica code that does the
>following:

>(a) Plots the parabola itself (duh). 

>(b) Does so on a a gridded piece of "graph paper", with the axes
>substantially darker than the rest of the grid. 

>(c) Both x and y axes are numbered at the units: 0, +-1, ..., +-10.
>The numbers should be to the left of the y axis, and below the x axis.
>The origin doesn't have to be labelled, if it's ugly, or too hard. 

>(d) The y axis is labelled "y" at the top of the graph, x axis is
>labelled "x" on the right. 

>(e) Puts little arrows on the 4 tips of the axes (signifying that they
>continue arbitrarily far). 

>(f) The following points are explicitly represented with
>reasonable-sized dots: (0,8), (2, 0), (3,-1), (4,0), and (6,8). 

>(g) It would be nice, but not essential, if the tips of the parabola
>itself had little arrows (again signifying that it continues upward
>with increasing abs(x) values.

The following code does most of what you listed above

<< Graphics`Arrow`;
Plot[(x - 3)^2 - 1, {x, -1, 10}, PlotRange -> {{-1, 7}, {-1, 10}},
 AxesStyle -> {Thickness[ .005]}, Ticks -> {Range[-1,7], Range[-1, 10]}, 
 AspectRatio -> 1, PlotPoints -> 50, AxesLabel -> {"x", "y"},
  Epilog -> {PointSize[ .015], Point/@ {{0, 8}, {2, 0}, {3, -1}, {4, 0}, {6, 8}}, 
     Arrow[{6, 0}, {7, 0}], Arrow[{0, 0}, {-1, 0}],
      Arrow[{0, 0}, {0, -1}], Arrow[{0, 9}, {0, 10}]}];
      
What is missing is the arrows on the ends of the parabola and the background grid. The background grid could be added with a GridLines->Automatic directive or a specific function for drawing the GridLines. To my eye, adding grid lines to this plot detracts from the information being displayed. I also think the heavy axes and arrows on the end of the axes distracts attention from the data (parabola and plotted points).

Visually, I think the following code produces a much better plot.

(Plot[(x - 3)^2 - 1, {x, -1, 10}, PlotRange -> {{-1,7}, {-1, 10}}, 
     AxesLabel -> {"\<x\>", "\<y\>"}, Ticks -> {Range[-1, 7], Range[\(-1\), 10]},
     AspectRatio -> 1, PlotPoints -> 50, AxesOrigin -> {-1, -1},
      Epilog -> {PointSize[ .015], Point /@ {{0, 8}, {2, 0}, {3, -1}, {4, 0}, {6, 8}}}];
 
 
 Which is better obviously depends on your taste and purpose.
 
 In any case a good reference on creating graphics in Mathematica is
 
 The Mathematica Graphics Guidebook by Cameron Smith and Nance Blachman
 
 This reference is somewhat dated since it only covers Mathematica version 2 and earlier. Despite this I still think it is one of the best guides to Mathematica graphics that has been written.

An excellent general guide to displaying graphic information is

The Visual Display of Quantitative Information written by Edward Tufte

This reference shows many examples of very bad and very good graphic displays. Tufte also give general guidelines for creating good graphics. Adding emphasis to the axes by making it darker and adding arrows is definitely inconsistent with the guidelines Tufte gives. 

Adding emphasis to the axes draws attention to the axes and away from the data (parabola and plotted points). Since the only reason for producing a graph is to display the data, other elements of the graph should help clarify the data, not draw attention away from the data.


  • Prev by Date: Re: How do I make graphs of (easy) functions like those in textbooks?
  • Next by Date: Re: How do I make graphs of (easy) functions like those in textbooks?
  • Previous by thread: RE: How do I make graphs of (easy) functions like those in textbooks?
  • Next by thread: Re: How do I make graphs of (easy) functions like those in textbooks?