[IPython-dev] ipython notebook and ggplot2

Robert McGibbon rmcgibbo@gmail....
Thu Dec 20 17:52:33 CST 2012


ggplot2 and base graphics in R use a totally different plotting mechanism and api. The IPython rmagic extension has built-in support for the base graphics system, but doesn't have corresponding support for 	ggplot.

The R cell isn't actually executed in that temporary directory, so its impossible to call the `save ggplot` command from R with the right path.

I just submitted a two line PR that should fix the issue for ggplot.

https://github.com/ipython/ipython/pull/2711

-Robert

On Dec 20, 2012, at 11:31 AM, Javier Martínez-López wrote:

> Thank you very much. I saved it and opened it with the 'Image' python command, but I still do not understand what is the difference between the usual and the ggplot2 graphs!
> 
> Javier
> 
> On Thu, Dec 20, 2012 at 8:09 PM, Robert McGibbon <rmcgibbo@gmail.com> wrote:
> Oh. Never mind. Since the R cell is executed in that temporary directory, just calling ggsave() with a relative path should just work. That will save the plot in the current
> temporary directory, and then ipython will find it and ship it to the browser.
> 
> -Robert
> 
> On Dec 20, 2012, at 10:45 AM, Thomas Kluyver wrote:
> 
>> On 20 December 2012 18:29, Robert McGibbon <rmcgibbo@gmail.com> wrote:
>> ggsave('temp.png'); system('open temp.png')
>> 
>> At the end of my plotting session. This pops up the plot in my image editor.
>> 
>> For the notebook, I think it's a little more complicated because you have to send the png to the front end through the display pub.
>> 
>> In fact, the notebook just sets up a specific temporary directory for your R code, and then displays the png files saved in there. Maybe we should expose that to the R code as something like _ipy_tmpd, so that you can save arbitrary png files?
>> 
>> Thomas
>> _______________________________________________
>> IPython-dev mailing list
>> IPython-dev@scipy.org
>> http://mail.scipy.org/mailman/listinfo/ipython-dev
> 
> 
> _______________________________________________
> IPython-dev mailing list
> IPython-dev@scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev
> 
> 
> _______________________________________________
> IPython-dev mailing list
> IPython-dev@scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/ipython-dev/attachments/20121220/8283044d/attachment-0001.html 


More information about the IPython-dev mailing list