[IPython-dev] ipython notebook and ggplot2
javi.martinez.lopez at gmail.com
Fri Dec 21 05:28:18 EST 2012
That works! I noticed already that I had to add the print command for
seeing variables and summaries but I didn't know it would work with plots.
Thank you very much.
On Fri, Dec 21, 2012 at 1:23 AM, Charlie Sharpsteen <chuck at sharpsteen.net>wrote:
> On Thu, Dec 20, 2012 at 3:52 PM, Robert McGibbon <rmcgibbo at gmail.com>wrote:
>> The IPython rmagic extension has built-in support for the base graphics
>> system, but doesn't have corresponding support for ggplot.
> (NOTE: Looks like Mailman may be eating my responses for some reason, so
> CCing those directly involved.)
> All you need for "corresponding support" is to call `print()` on the
> output of grid graphics (such as ggplot2) when writing R code.
> The plotting functions in the base graphics system immediately paint
> results to the output device when the function is executed. In contrast,
> the plotting functions in the grid system return objects. This
> object-oriented nature is what makes ggplot2 work so well---complicated
> graphics can be built in an intuitive fashion because each function is
> returning objects that can be combined via overloaded addition operators.
> grid graphics aren't painted to the output device until the `print()`
> method is called on the object.
> The source of confusion is that the native R REPL (i.e. the thing that
> people play with when using the R GUI or the R command line interface)
> implicitly calls `print()` on the result of every computation. When running
> R programs outside of the official REPL, such as through RScript or in this
> case rpy2, the calls to `print()` must be explicitly added by the
> programmer in order to get code that works the same way.
> This is true for several R objects, but is especially noticeable with grid
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the IPython-dev