[Rd] Overriding axis formatting with custom Axis method, Axis.numeric etc

Sklyar, Oleg (MI London) osklyar at maninvestments.com
Mon Apr 7 14:58:58 CEST 2008

Dear Prof Ripley,

thank you for your suggestions, they are as always very insightful!
Although, anybody can miss a point or two as I just did in namespaces.
Is the following correct?

Until redefined in the current namespace, plot.default (and all other
plot.* methods) being defined in 'graphics' calls Axis.default also
defined in 'graphics' and it is pointless to redefine Axis.default
without redefining plot.default in the same namespace? It worked for me
with Axis.numeric simply because the latter matches better than
Axis.default and it is not defined in 'graphics'.

So the question is: is there any obvious way around to redefine axis
formatting to be used with all plot.* methods in the current namespace
avoiding duplicating all the plot.* methods along with writing new
Axis.* methods?

Another understanding issue: it looks like I do really need to import
all plot methods, copy and paste the code for them and export them again
to make the whole idea work. I.e. it is not sufficient to simply
importFrom(graphics, plot.default); define Axis.default;
export(plot.default, Axis.default) in order to make it work. It is also
not sufficient to have something like plot.default =
graphics::plot.default in package code. In fact, to make it work I had
to copy and paste the full implementation of plot.default (although
without altering a single character). Am I missing something obvious? 

> Axis() is an S3 generic, not an S4 generic, so it does not 
> make sense to me to talk about 'signatures'.  It is in the 
> graphics namespace, so you cannot redefine it for use by plot.default.

Well, I would assume that default, POSIXct, POSIXlt and Date are kind of
S3 signatures for Axis (Axis.*) But thanks for hinting at "methods",
this was indeed what I needed.


> sessionInfo()
R version 2.6.2 (2008-02-08)


attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

loaded via a namespace (and not attached):
[1] rcompgen_0.1-17

The contents of this email are for the named addressee(s) only.
It contains information which may be confidential and privileged.
If you are not the intended recipient, please notify the sender
immediately, destroy this email and any attachments and do not
otherwise disclose or use them. Email transmission is not a
secure method of communication and Man Investments cannot accept
responsibility for the completeness or accuracy of this email or
any attachments. Whilst Man Investments makes every effort to keep
its network free from viruses, it does not accept responsibility
for any computer virus which might be transferred by way of this
email or any attachments. This email does not constitute a request,
offer, recommendation or solicitation of any kind to buy, subscribe,
sell or redeem any investment instruments or to perform other such
transactions of any kind. Man Investments reserves the right to
monitor, record and retain all electronic communications through
its network to ensure the integrity of its systems, for record
keeping and regulatory purposes. 

Visit us at: www.maninvestments.com

More information about the R-devel mailing list