MathGroup Archive 2002

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

Search the Archive

RE: very simple plot format

  • To: mathgroup at smc.vnet.net
  • Subject: [mg33903] RE: [mg33891] very simple plot format
  • From: "David Park" <djmp at earthlink.net>
  • Date: Mon, 22 Apr 2002 00:57:38 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Daniel,

Not so simple. Look up FrameTicks, Ticks and GridLines in Help. You can then
define your ticks and grid lines and use them in your plot.

Needs["Graphics`Colors`"]

xgrid = Table[{i, {LightGray}}, {i, -10, 10}];
ygrid = Table[{i, {LightGray}}, {i, -25, 17}];

xticks = Join[Table[{i, i, {0.00650, 0}}, {i, -10, 10, 5}],
      Table[{i, "", {0.00325, 0}}, {i, -10, 10, 1/2}]];
yticks = Join[Table[{i, i, {0.00650, 0}}, {i, -25, 15, 5}],
      Table[{i, "", {0.00325, 0}}, {i, -25, 15, 1/2}]];
xtickstop =
    Join[Table[{i, "", {0.00650, 0}}, {i, -10, 10, 5}],
      Table[{i, "", {0.00325, 0}}, {i, -10, 10, 1/2}]];
yticksright =
    Join[Table[{i, "", {0.00650, 0}}, {i, -25, 15, 5}],
      Table[{i, "", {0.00325, 0}}, {i, -25, 15, 1/2}]];

Plot[2 x - 4, {x, -10, 10},
    Frame -> True,
    FrameTicks -> {xticks, yticks, xtickstop, yticksright},
    GridLines -> {xgrid, ygrid},
    PlotLabel -> "Graph Paper With Custom Ticks",
    ImageSize -> 500];

The DrawGraphics package, at my web site, has the routines CustomGridLines
and CustomTicks which simplify the specification.

Needs["DrawGraphics`DrawingMaster`"]

Plot[2 x - 4, {x, -10, 10},
    Frame -> True,
    FrameTicks ->
      {CustomTicks[Identity, {-10, 10, 5, 10}],
        CustomTicks[Identity, {-25, 20, 5, 10}],
        CustomTicks[Identity, {-10, 10, 5, 10}, CTNumberFunction -> ("" &)],
        CustomTicks[Identity, {-25, 20, 5, 10}, CTNumberFunction -> (""
&)]},
    GridLines ->
      {CustomGridLines[Identity, {-10, 10, 1}, {LightGray}],
        CustomGridLines[Identity, {-25, 17, 1}, {LightGray}]},
    PlotLabel -> "Graph Paper With Custom Ticks",
    ImageSize -> 500];

Carl Bergstrom introduced me to a marvelous book: "The Visual Display of
Quantitative Information" by Edward R. Tufte. One of Tufte's principles is
"Maximize the information. Minimize the Ink." In this sense, a graph with
lots of gridlines and lots of ticks might not be the optimal method for
presenting a simple linear graph. Unless this is specifically a graphics
exercise, a table might even be better.

David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/




> From: Daniel [mailto:res04oor at gte.net]
To: mathgroup at smc.vnet.net
>
> My problem is getting gridlines and tick marks the way I want them.  I
> cannot find an explicit answer in the Mathematica book.  Consider the
> following simple plot:
> Plot[2 x - 4, {x,-10,10}]
> I want gridlines at every integer in the domain and the range, and tick
> marks at the fraction of integer, for example.  How can I
> expressly detrmine
> the placement of gridlines etc.
>
> d.man25 at gte.net
>
> Thanks
>
>



  • Prev by Date: Re: Re: Integrate malfunction?
  • Next by Date: RE: RE: Need a algorithm
  • Previous by thread: Re: very simple plot format
  • Next by thread: References to subjects of Mathematica notebooks