[RkWard-devel] comments on plot_options and distribution plots
Thomas Friedrichsmeier
thomas.friedrichsmeier at ruhr-uni-bochum.de
Thu Feb 1 10:32:52 UTC 2007
On Thursday 01 February 2007 08:52, Prasenjit Kapat wrote:
> * Specifying the Y-Limits (ylim) creates a column vector: c(a,,b) - there
> is an extra "," in between.
True. Fixed.
> * Like allow_log or allow_aspect, other parts of plot_options should also
> have allow_tag options in <external>, for more embedding flexibility.
Should not be a problem. Which ones do you have in mind?
> distribution plots + plot_options
> ------------------------------------------------
> * Option for Log-scale gets repeated: of course I can remove one of them or
> set allow_log to "false".
Well, there is a subtle difference: The current log option takes the log of
the value. The plot_options log option draws the scale logarithmic.
> * Other problem is with xlim. I think this is an issue in R. Try the
> following R code:
> plot (function (x) dbinom (x, size = 12, prob=0.5000), from=0, to=12,
> n=13, type="p",xlim=c (2, 8))
> It gives an error with 'xlog' !
Oh dear. What is that supposed to mean? This does look like some sort of bug
in plot, since actually plot.function seems to be quite happy to take both a
from/to and xlim.
This works, but probably we should not use it:
graphics:::plot.function (function (x) dbinom (x, size = 12, prob=0.5000,
log=TRUE), from=0, to=12, n=13, type="p", xlim=c (2,8))
This modified plot function will do the trick, too (removed the y parameter
from the call to plot.function, but I don't understand, what it was supposed
to do):
"plot2" <- function (x, y, ...)
{
if (is.null(attr(x, "class")) && is.function(x)) {
nms <- names(list(...))
if (missing(y))
y <- {
if (!"from" %in% nms)
0
else if (!"to" %in% nms)
1
else if (!"xlim" %in% nms)
NULL
}
if ("ylab" %in% nms)
plot.function(x, ...)
else plot.function(x, ylab = paste(deparse(substitute(x)),
"(x)"), ...)
}
else UseMethod("plot")
}
So this does look like a bug in R, IMO. Do you feel like posting a message
about that to r-help AT r-project.org? Else I'll do so, but not sure, when
I'll get around to.
> In the light of the plot_options, I think
> it will be better to go back to:
>
> x = seq(from=0,to=12,length=13)
> y = dbinom(x,size=12,prob=0.5)
> plot(x=x,y=y<? getRK ("plotoptions.code.printout"); ?>)
Hmm. Not too pretty, if we can avoid it. I suggest delay using the
plot_options plugin for now (or disable the xlim/ylim for now; I can add an
option for that). Let's see, what the R people have to say about this, first.
> Other comments:
> --------------------------
> * Sometimes just closing the RKWard window does not ask for the "Save
> Workspace" dialog. It has happend quite a few time recently.
Ah, that would be due to the fact that I removed some internal RKWard objects
from .GlobalEnv. The policy was to only ask whether to save, if there were
any objects in .GlobalEnv. Since RKWard placed objects in there since many
versions, that effectively boiled down to always asking.
I guess I'll simply make it always ask again, then worry about a better
heuristic/configuration option for a later release.
Regards
Thomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/rkward-devel/attachments/20070201/66fa470f/attachment.sig>
More information about the Rkward-devel
mailing list