MathGroup Archive 1995

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

Search the Archive

Re: GridLines in LogLogPlot

  • To: mathgroup at christensen.cybernetics.net
  • Subject: [mg848] Re: GridLines in LogLogPlot
  • From: novak (John M. Novak)
  • Date: Wed, 26 Apr 1995 00:15:18 -0400
  • Organization: Wolfram Research, Inc.

Sergio Rescia wrote about a problem with grid lines in LogLogPlot.

The development version of the package is much better behaved in this
respect; it at least handles your example correctly. (Note that you
probably also want to set Axes->False in your particular example; the
axes are easily confused with the grid lines.)

For the convenience of all, I have uploaded the current version of the
package to MathSource, which still works in the current version of
Mathematica, and fixes several problems with Graphics.m. You can find
it in item number 0200-507 (Graphics.m).

The origin of the problem that Sergio Rescia encountered is that
the log plots, like many graphics functions, assume that you don't
want your display to be too cluttered; it places a limited number of
grid lines/tick marks, with positions based on an internal symbol
called $LogPreferences. My revision (among other things) boosts the
number of lines that will be drawn by default; this will usually give
a good display. However, if you don't care how cluttered your graphic
is, you can use the following function to place grid lines at every
one of the usual grid line locations.

Note that the current behavior of the log coordinate system varies
depending on whether you are calling LogPlot (and similar functions)
directly, or modifying an existing graphic via Show. (This is because
I haven't yet implemented a way to determine whether an existing graphic
has a scaled coordinate system; this is nontrivial to do in a general
fashion.) If you are using Show on an existing graphic (which is
rendered with log coordinates), you can use the following small function
to place grid lines at all locations:

loggrid[min_, max_] :=
   Log[10,
      Flatten[
         Map[ Range[1, 9]*10^# &, Range[Floor[min], Ceiling[max]] ]
      ]
    ]//N

and say

Show[graphic, GridLines -> {loggrid, loggrid}]

in the case where 'graphic' is a log-log plot.

I hope this is useful!

--John M. Novak
novak at wri.com
Wolfram Research, Inc. -- Applications Development





  • Prev by Date: Strange answer from Eigensystem[]!
  • Next by Date: Re: Strange answer from Eigensystem[]!
  • Previous by thread: Re: GridLines in LogLogPlot
  • Next by thread: Mathematica speech interface for blind user?