[rkward-devel] RV: Problems with ggplot2

Thomas Friedrichsmeier thomas.friedrichsmeier at ruhr-uni-bochum.de
Tue Jun 25 15:47:11 UTC 2013


Hi,

On Tuesday 25 June 2013 13:42:27 SANCHEZ ALBERCA, ALFREDO wrote:
> The plugin is in Spanish, but I'm translating it to English now, and I will
> share it in a few weeks. The code for generating the graphic it's a bit
> complicated, and that no helps to understand the problem. So I've tried to
> do a simple example with your code, just putting it inside the
> doPrintout(full) function: function doPrintout (full) {
>         echo ('print(qplot(mpg, wt, data=mtcars))\n');
> }
> 
> and I get the graphic in a new window, but no in the output window
> rk_out.html Thanks!

see 
http://rkward.sourceforge.net/documents/devel/plugins/specialized_plugins.html#specialized_plugins_plots

To plot to the output window, wrap add rk.graph.on() / rk.graph.off() around 
the plotting statement(s). Assuming you have a preview box (easy enough to 
add), that will be

function doPrintout (full) {
  if (full) {
    echo ('rk.header("Some interesting plot")\n\n');
    echo ('rk.graph.on()\n');
  }

  echo ('try ({\n');
  echo ('\tprint(qplot(mpg, wt, data=mtcars))\n');
  echo ('})\n');

  if (full) {
    echo ('rk.graph.off()\n');
  }
}

Regarding the rkward::plot_options embeddable plugin, I'm not quite sure, 
which options are usable with ggplots. Many (like xlim, ylim) should work 
fine, though, so consider adding this, too, as outlined in the documentation 
linked to, above.

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/20130625/e9f7346d/attachment.sig>


More information about the Rkward-devel mailing list