[RkWard-devel] Distribution plots: not quite right!
Thomas Friedrichsmeier
thomas.friedrichsmeier at ruhr-uni-bochum.de
Wed Jan 24 14:29:35 UTC 2007
On Wednesday 24 January 2007 09:40, Prasenjit Kapat wrote:
> This is sort of nitpicking. When I do a plot from Distribution + Continuous
> dist. + Plot Normal distribution, the x-axis of the plot shows the indices
> of the points. Which I feel is not right. For any such plot the x-axis
> should display the values from the domain of the distribution and the
> y-axis the density (or cumulative distribution function) value. I suggest
> the following change:
Indeed, you are right. Thanks for pointing this out.
> rk.graph.on ()
> try (plot (x=seq(<? getRK ("min"); ?> ,<? getRK ("max"); ?>, length= <?
> getRK ("n"); ?>), y=<? getRK ("function"); ?> (seq(<? getRK ("min"); ?> ,<?
> getRK ("max"); ?>, length= <? getRK ("n"); ?>) , mean = <? getRK ("mean");
> ?>, sd = <? getRK ("sd"); ?>),xlab="x",ylab="density at x"))
Looking at it, the following may be a more elegant way to do it:
try (plot (function (x) <? getRK ("function"); ?> (x, mean = <? getRK
("mean"); ?>, sd = <? getRK ("sd"); ?>), from=<? getRK ("min"); ?>, to=<?
getRK ("max"); ?>), n=<? getRK ("n"); ?>)
(example R code:)
plot (function (x) dnorm (x, mean=1, sd=1), from=-3, to=3, n=100)
This way we'd get a continuous plot (of course this does not make much sense
for the discrete distributions, but for the continuous distributions it's
probably more elegant). To get the current discrete plotting, we'd use
plot (function (x) dnorm (x, mean=1, sd=1), from=-3, to=3, n=100, type="p")
> The xlabel and ylabel may be avoided.
I guess, for simplicty, that would be best. Later, maybe we want to offer an
extended set of options, with user-changable labels among them.
> The "normal" distribution was just an
> example, this needs to be done for all the distributions.
>
> 1. If this is too boring a task for many of you then I can sit over a
> weekend and change the files and send the patches.
If you'd volunteer to do this, that would truly be helpful.
> 2. Moreover, similar things need to be done for other distribution.
>
> 3. A better way would be to do a graphics display rather than a R Output,
> whereby by changing the parameters of the distribution and "re-submitting"
> the plots can be "dynamically" visialized.
One long term TODO item is a "preview" window for graphs. That's probably the
only clean solution (if we would simply replace rk.graph.on () by x11 (),
we'd open a new window on each "Submit"; if we would omit rk.graph.on/off ()
altogether, we'd simply plot to whichever device is currently active, risking
to mess up unrelated graphs), but will require some work to implement.
> 4. In the long run, two-dimensional distributions could be similarly
> visialized using the "rgl" package. It is a very priliminary interface of
> OpenGL using R.
It looks like something to keep an eye on.
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/20070124/4fb5db9c/attachment.sig>
More information about the Rkward-devel
mailing list