[rkward-devel] Problems with ggplot2

Thomas Friedrichsmeier thomas.friedrichsmeier at ruhr-uni-bochum.de
Thu Jun 20 15:45:28 UTC 2013


Hi!

On Monday 17 June 2013 15:07:32 SANCHEZ ALBERCA, ALFREDO wrote:
> I have a RKWard plugin that plot some graphics and I wan to update it to use
> ggplot2. When I use the plot function I get the graphics without problems,
> but when I use the qplot function of package ggplot2, I get nothing.
> However, it works when I use the command line.
> Has anybody tried ggplot2 with RKWard?

As Meik has pointed out, some example lines of (generated) code would be 
useful. But as a first guess, the gotcha is auto-printing:

ggplot2 functions, in contrast to "regular" plotting functions, do not 
actually "have the side-effect" of creating a plot, but rather they create an 
object, that - when printed - creates a plot. When running code on the top-
level, line by line, values get auto-printed. But once you leave the top-level 
(as does all plugin code), the difference becomes visible. Consider these 
examples:

{ qplot(mpg, wt, data=mtcars); 1 }
{ x <- qplot(mpg, wt, data=mtcars); 1; x }
{ print(qplot(mpg, wt, data=mtcars)); 1 }

The third example should point to the correct solution: Call print(), 
explicitly, to make the plot show up.

Regards
Thomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/rkward-devel/attachments/20130620/d7450eff/attachment.sig>


More information about the Rkward-devel mailing list