From plummer@iarc.fr  Fri Jun 26 13:45:11 1998
From: plummer@iarc.fr (Martyn Plummer)
Date: Fri, 26 Jun 1998 12:45:11 -0000 ()
Subject: R-beta: PostScript tick marks in 62.1
In-Reply-To: <Pine.3.87.9806251017.A16855-0100000@superh.hg.med.umich.edu>
Message-ID: <XFMail.980626130136.plummer@iarc.fr>

[Moved over from R-help - MTP]

On 25-Jun-98 Matthew R. Nelson wrote:
>I should have added that the plot was generated with log="xy".  On my 
>computer, this simple example recreates the problem:
>
>> postscript("tmp.ps", width=6, height=6, family="Times") 
>> plot((1:10)^2, (1:10)^3, log="xy") 
>> dev.off()
>
>With this simple plot function, I get 2 x-axis tick marks and 1 y axis 
>tick mark, but the expected number of axis labels.

I get the same thing. Sorry for doubting you, but a concrete example
helps to locate the problem.  The missing tick marks are being clipped
because somewhere in the graphics code, the information that we are
using the log scale for the axes is being lost.

Here's a patch for src/graphics/graphics.c

M.

--- graphics.c  Fri Jun 26 14:29:04 1998
+++ graphics.new        Fri Jun 26 14:30:42 1998
@@ -999,13 +999,19 @@
 double xDevtoUsr(double x, DevDesc *dd)
 {
   double nfc = xDevtoNFC(x, dd);
-  return (nfc - dd->gp.win2fig.ax)/dd->gp.win2fig.bx;
+  if (dd->gp.xlog)
+     return pow(10, (nfc - dd->gp.win2fig.ax)/dd->gp.win2fig.bx);
+  else
+     return (nfc - dd->gp.win2fig.ax)/dd->gp.win2fig.bx;
 }

 double yDevtoUsr(double y, DevDesc *dd)
 {
   double nfc = yDevtoNFC(y, dd);
-  return (nfc - dd->gp.win2fig.ay)/dd->gp.win2fig.by;
+  if (dd->gp.ylog)
+    return pow(10, (nfc - dd->gp.win2fig.ay)/dd->gp.win2fig.by);
+  else
+    return (nfc - dd->gp.win2fig.ay)/dd->gp.win2fig.by;
 }
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


R-beta: PostScript tick marks in 62.1
Martyn Plummer