MathGroup Archive 1995

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

Search the Archive

Re: GridLines in LogLogPlot

  • To: mathgroup at christensen.cybernetics.net
  • Subject: [mg840] Re: GridLines in LogLogPlot
  • From: cal at star.stanford.edu (Calvin Teague)
  • Date: Tue, 25 Apr 1995 02:21:26 -0400
  • Organization: Stanford University

In article <3n4mqg$q7o at news0.cybernetics.net>, sergio at shark.inst.bnl.gov
(Sergio Rescia) wrote:

> Dear Mathgrouper,
> 
> Please take a look at the attached graphics file (It is a LogLogPlot: it
needs 
> Graphics`Graphics` to display).  [omitted]
> 
> The grid lines at the bottom, horizontally are wrong.
> 
> There are correctly grid lines at y=2. 10^-6 and 5. 10^-6.
> I would expect two more grid lines at y=3. 10^-6 and y=4. 10^-6. Instead
there is only a single 
> grid lines which turns out to be at y=3.5 10^-6.
> 
> This is mathematically correct, of course, but nevertheless it is very
confusing
> when showing this kind of plots to an engineering audience.
> 
> Is there a fix to allow for grid lines in a 2-3-4-5...or possibly a
2-5-10 sequence in a LogLogPlot?


I noticed similar behavior with LogLogPlot.  The problem appears to
involve rounding in a floating-to-integer conversion.  After much tracing,
I was able to correct it by adding a very small bias
(10^-($MachinePrecision-1)) to the argument of Floor[] in the function
MinorAux1[] in my copy of  Graphics.m  as follows:

Change

MinorAux1[x_] :=
        Module[{n=Floor[ x/10^Floor[ Log[10., x]]]},
                If[ n < 1, {1,1}, {x/n, n}]
        ]

to

MinorAux1[x_] :=
        Module[{n=Floor[ x/10^Floor[ Log[10., x]] +
                  10^-($MachinePrecision-1) ]},
                If[ n < 1, {1,1}, {x/n, n}]
        ]


I can't guarantee that this will work in all cases, but it did work for
the cases that I tried (involving similar small values for the variables
plotted).

Calvin Teague, cal at star.stanford.edu


  • Prev by Date: Re: Large data sets?
  • Next by Date: Re: Adding identification marks to a Plot
  • Previous by thread: GridLines in LogLogPlot
  • Next by thread: Re: GridLines in LogLogPlot