[IPython-dev] ipython notebook and ggplot2
Javier Martínez-López
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.
Javier
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
> graphics.
>
> -Charlie
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20121221/b01fdcb0/attachment.html>
More information about the IPython-dev
mailing list