Browse Source

Dummy function pour plot.default prenant en compte les labels

master
unknown 10 years ago
parent
commit
01229485b2
3 changed files with 81 additions and 0 deletions
  1. +1
    -0
      NAMESPACE
  2. +65
    -0
      R/label.R
  3. +15
    -0
      man/plot.default.Rd

+ 1
- 0
NAMESPACE View File

@@ -4,3 +4,4 @@ export("label<-.default")
export(charger)
export(label)
export(label.default)
export(plot.default)

+ 65
- 0
R/label.R View File

@@ -67,4 +67,69 @@ label.default <- function(objet)
}
}
objet
}

#' Fonction de remplacement pour plot
#'
#' plot en utilisant les labels comme étiquettes
#'
#' @encoding ISO-8859-1
#' @export
plot.default<-function (x, y = NULL, type = "p", xlim = NULL, ylim = NULL,
log = "", main = NULL, sub = NULL, xlab = NULL, ylab = NULL,
ann = par("ann"), axes = TRUE, frame.plot = axes, panel.first = NULL,
panel.last = NULL, asp = NA, ...)
{
localAxis <- function(..., col, bg, pch, cex, lty, lwd) Axis(...)
localBox <- function(..., col, bg, pch, cex, lty, lwd) box(...)
localWindow <- function(..., col, bg, pch, cex, lty, lwd) plot.window(...)
localTitle <- function(..., col, bg, pch, cex, lty, lwd) title(...)
xlabel <- if (!missing(x))
{
if (is.null(label(x)))
deparse(substitute(x))
else
label(x)
}
ylabel <- if (!missing(y))
{
if (is.null(label(y)))
deparse(substitute(y))
else
label(y)
}
xy <- xy.coords(x, y, xlabel, ylabel, log)
xlab <- if (is.null(xlab))
xy$xlab
else xlab
ylab <- if (is.null(ylab))
xy$ylab
else ylab
xlim <- if (is.null(xlim))
range(xy$x[is.finite(xy$x)])
else xlim
ylim <- if (is.null(ylim))
range(xy$y[is.finite(xy$y)])
else ylim
dev.hold()
on.exit(dev.flush())
plot.new()
localWindow(xlim, ylim, log, asp, ...)
panel.first
plot.xy(xy, type, ...)
panel.last
if (axes) {
localAxis(if (is.null(y))
xy$x
else x, side = 1, ...)
localAxis(if (is.null(y))
x
else y, side = 2, ...)
}
if (frame.plot)
localBox(...)
if (ann)
localTitle(main = main, sub = sub, xlab = xlab, ylab = ylab,
...)
invisible()
}

+ 15
- 0
man/plot.default.Rd View File

@@ -0,0 +1,15 @@
\encoding{ISO-8859-1}
\name{plot.default}
\alias{plot.default}
\title{Fonction de remplacement pour plot}
\usage{
plot.default(x, y = NULL, type = "p", xlim = NULL,
ylim = NULL, log = "", main = NULL, sub = NULL,
xlab = NULL, ylab = NULL, ann = par("ann"),
axes = TRUE, frame.plot = axes, panel.first = NULL,
panel.last = NULL, asp = NA, ...)
}
\description{
plot en utilisant les labels comme étiquettes
}


Loading…
Cancel
Save