[R] R: Error in plot.new() : axis style "d" not implemented

Uwe Ligges ligges at statistik.uni-dortmund.de
Tue Nov 12 21:59:46 CET 2002


Hinnerk Boriss wrote:
> 
> Hi there!
> 
> Both on windows and Solaris platforms I run into troubles when trying to
> draw two plots on top of each other. Here a short code example:
> 
> > x1 <- c(2,3,4,5,6,7,8)
> > y1 <- sin(x1)
> > x2 <- c(1,2,3,4,5,6,7,8,9,10)
> > y2 <- cos(x2)
> > d1 <- cbind(x1,y1)
> > d2 <- cbind(x2,y2)
> > plot(d1)
> > par(new=T, xaxs="d")
> > plot(d2)
> Error in plot.new() : axis style "d" unimplemented
> >
> 
> And here an excerpt from the R help pages:
> xaxs
> The style of axis interval calculation to be used for the x-axis.
> Possible values are "r", "i", "e", "s", "d". The styles are generally
> controlled by the range of data or xlim, if given. Style "r" (regular)
> first extends the data range by 4 percent and then finds an axis with
> pretty labels that fits within the range. Style "i" (internal) just
> finds an axis with pretty labels that fits within the original data
> range. Style "s" (standard) finds an axis with pretty labels within
> which the original data range fits. Style "e" (extended) is like style
> "s", except that it is also ensured that there is room for plotting
> symbols within the bounding box. Style "d" (direct) specifies that the
> current axis should be used on subsequent plots. (Only "r" and "i"
> styles are currently implemented)
> 
> As I understand the manual pages, this should work. However it doesn't.

Please read the last sentence you cited --- right, the one in brackets!
It means: "d" is NOT implemented.


> Is there any other way to combine plots and align them on the same axis?
> I hope someone can help.

Try points(x2, y2) instead of the second call to plot().
Maybe you need to scale the axes in the first call to plot(), or e.g.
like:

 plot(c(x1, x2), c(y1, y2), type = "n")
 points(x1, y1)
 points(x2, y2)

Uwe Ligges
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help 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-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list