<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>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 <span class="Apple-tab-span" style="white-space:pre">       </span>ggplot.</div><div><br></div><div>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.</div><div><br></div><div>I just submitted a two line PR that should fix the issue for ggplot.</div><div><br></div><div><a href="https://github.com/ipython/ipython/pull/2711">https://github.com/ipython/ipython/pull/2711</a></div><div><br></div><div>-Robert</div><div><br><div><div>On Dec 20, 2012, at 11:31 AM, Javier Martínez-López wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">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!<br><br>Javier<br><br><div class="gmail_quote">
On Thu, Dec 20, 2012 at 8:09 PM, Robert McGibbon <span dir="ltr"><<a href="mailto:rmcgibbo@gmail.com" target="_blank">rmcgibbo@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; position: static; z-index: auto; ">
<div style="word-wrap:break-word">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<div>temporary directory, and then ipython will find it and ship it to the browser.</div>
<span class="HOEnZb"><font color="#888888"><div><br></div></font></span><div><div><div><span class="HOEnZb"><font color="#888888"><div>-Robert</div></font></span><div><br><div><div class="im"><div>On Dec 20, 2012, at 10:45 AM, Thomas Kluyver wrote:</div>
<br></div><blockquote type="cite"><div><div class="h5"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 20 December 2012 18:29, Robert McGibbon <span dir="ltr"><<a href="mailto:rmcgibbo@gmail.com" target="_blank">rmcgibbo@gmail.com</a>></span> wrote:<br>


<blockquote class="gmail_quote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; position: static; z-index: auto; ">
ggsave('temp.png'); system('open temp.png')<br>
<br>
At the end of my plotting session. This pops up the plot in my image editor.<br>
<br>
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.</blockquote></div><br></div><div class="gmail_extra">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?<br>


<br></div><div class="gmail_extra">Thomas<br></div></div></div></div><div class="im">
_______________________________________________<br>IPython-dev mailing list<br><a href="mailto:IPython-dev@scipy.org" target="_blank">IPython-dev@scipy.org</a><br><a href="http://mail.scipy.org/mailman/listinfo/ipython-dev" target="_blank">http://mail.scipy.org/mailman/listinfo/ipython-dev</a><br>
</div></blockquote></div><br></div></div></div></div></div><br>_______________________________________________<br>
IPython-dev mailing list<br>
<a href="mailto:IPython-dev@scipy.org">IPython-dev@scipy.org</a><br>
<a href="http://mail.scipy.org/mailman/listinfo/ipython-dev" target="_blank">http://mail.scipy.org/mailman/listinfo/ipython-dev</a><br>
<br></blockquote></div><br>
_______________________________________________<br>IPython-dev mailing list<br><a href="mailto:IPython-dev@scipy.org">IPython-dev@scipy.org</a><br>http://mail.scipy.org/mailman/listinfo/ipython-dev<br></blockquote></div><br></div></body></html>