Revision: 503 http://rpy.svn.sourceforge.net/rpy/?rev=503&view=rev Author: warnes Date: 2008-04-24 07:07:58 -0700 (Thu, 24 Apr 2008)
Log Message: ----------- Remove auto-generated html file from SVN repository Removed Paths: ------------- trunk/htdocs/plotting-with-RPy.html Deleted: trunk/htdocs/plotting-with-RPy.html =================================================================== --- trunk/htdocs/plotting-with-RPy.html 2008-04-24 13:59:59 UTC (rev 502) +++ trunk/htdocs/plotting-with-RPy.html 2008-04-24 14:07:58 UTC (rev 503) @@ -1,284 +0,0 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -<html> - <head> - <title>Plotting with RPy </title> - <link rel="stylesheet" type="text/css" href="style.css" /> - </head> - <body> - - <!-- Logo --> - <table class="box"> - <tbody> - <tr> - <td align="center" valign="top" class="left"> <!-- bgcolor="White" --> - <img src="graphics/rpy_logo.png" alt="RPy"> - </td> - <td> - </td> - <td> - <p> A simple and efficient access to R from Python - </p> - </td> - </tr> - </tbody> - </table> - <!-- Document table --> - <table class="box"> - <tbody> - <tr> - <td class="left"> - - -<table class="box"> - <tbody> - <!-- Navigation bar --> - <tr> - <td> - <div class="header"> - <strong>Sections</strong> - </div> - <ul class="menu"> - <li><a href="index.html">About</a></li> - <li><a href="http://rpy.wiki.sourceforge.net/">Wiki</a></li> - <li><a href="bugs.html">Bugs</a></li> - <li><a href="svn.html">SVN</a></li> - <li><a href="download.html">Download</a></li> - <li><a href="documentation.html">Documentation</a></li> - <li><a href="rpy_demo.html">Demo</a></li> - <li><a href="faq.html">FAQ</a></li> - <li><a href="maillist.html">Mail List</a></li> - <li><a href="news.html">News</a></li> - <li><a href="todo.html">To do</a></li> - <li><a href="http://sourceforge.net/projects/rpy">SourceForge</a></li> - </ul> - </td> - </tr> - <!-- Exits table --> - - <tr> - <td> - <div class="header"> - <strong>Exits</strong> - </div> - <ul class="menu"> - <li><a href="http://www.python.org/">Python</a></li> - <li><a href="http://www.r-project.org/">R language</a></li> - <li><a href="http://www.omegahat.org/RSPython">RSPython</a></li> -<!-- - <li><a href="http://www.analytics.washington.edu/Zope/projects/RSOAP">RSOAP (SOAP for R)</a></li> - <li><a href="http://www.analytics.washington.edu/Zope/projects/RSessionDA">RSessionDA (R for Zope)</a></li> ---> - </ul> - </td> - </tr> - <!-- Acknowledgements table --> - <tr> - <td> - <div class="header"> - <strong>Acknowledgement</strong> - </div> - This site is hosted by - <a href="http://sourceforge.net/projects/rpy"> - <img src="head_bg_new.gif"> - </a> - </td> - </tr> - </tbody> - </table> - <!-- END Acknowledgements table --> - - - </td> - <td valign="top" width="60%" class="central"> - - <!-- Central section --> - <div class="central"> - <center> - <h2> RPy (R from Python) </h2> - </center> - <!-- END Title --> - <hr> - <!-- INCLUDE DATA HERE --> - <h3>Plotting with RPy </h3> - <!-- page-title: Plotting with RPy --> -<!-- title: Plotting with RPy --> - - -RPy (<a href="http://rpy.sf.net/">rpy.sf.net</a>) is a simple and -easy-to-use <a href="http://www.python.org/">Python</a> interface for the -<a href="http://www.r-project.org/">R Programming Language</a>. - -<p> - -The advantage to using RPy for plotting is that R is a high-quality -environment for doing statistics and math work that comes with many, -many, <i>many</i> plotting features. The disadvantage is that R -is a large language with its own complexities. -This page is a simple tutorial meant to get you to your first plot, -and point you on your way towards your 2nd, 3rd, and Nth plots. - -<h3>Getting started</h3> - -To start, <a href="http://rpy.sourceforge.net/download.html">install -RPy</a>. (You'll probably need to <a -href="http://cran.r-project.org/mirrors.html">install R</a>, too.) -<p> -Now run Python, and enter the following code: -<blockquote> -<pre> -from rpy import * - -x = range(0, 10) -y = [ 2*i for i in x ] - -r.plot_default(x, y) -</pre> -</blockquote> -Assuming everything was installed correctly, and R can connect to your -display (this could be tricky if you're using a remote Linux box from -a Windows machine -- talk to your local Linux expert, or install R -locally!) you should see a simple graph that plots x vs 2*x for x ranging -from 0 to 9. This is what I see: -<p> -<a href="plotting-with-rpy-1.png"><img border=1 width=150 src=plotting-with-rpy-1.png></a> -<p> - -<h3>Getting moderately tricky</h3> - -Let's plot multiple things, with lines, in different colors! -(Exciting, ehh?) - -<blockquote><pre> -from rpy import * -import math - -x = range(0, 10) -y1 = [ 2*i for i in x ] -y2 = [ math.log(i+1) for i in x ] - -r.plot_default(x, y1, col="blue", type="o") -r.points(x, y2, col="red", type="o") -</pre></blockquote> -You should see something like this: -<p> -<a href="plotting-with-rpy-2.png"><img border=1 width=150 src=plotting-with-rpy-2.png></a> -<p> - -<h3>Axis labels and titles</h3> - -Finally, let's add some axis labels and a title. - -<blockquote><pre> -from rpy import * -import math - -x = range(0, 10) -y1 = [ 2*i for i in x ] -y2 = [ math.log(i+1) for i in x ] - -r.plot_default(x, y1, col="blue", type="o") -r.points(x, y2, col="red", type="o") - -xlabels = [ "#%d" % (i,) for i in x ] -r.axis(1, at = x, label=xlabels, lwd=1, cex_axis=1.15) -r.title("My Plot") -</pre></blockquote> - -<p> -<a href="plotting-with-rpy-3.png"><img border=1 width=150 src=plotting-with-rpy-3.png></a> -<p> - -<h3>Outputting to a file</h3> - -You can set things up to output to a file by putting either of -these commands in front of the <tt>plot_default</tt> command: -<pre> -outfile = "somefile.ps" -r.postscript(outfile, paper='letter') -</pre> -or -<pre> -outfile = "somefile.png" -r.bitmap(outfile, res=200) -</pre> - -The former writes a postscript file, and the latter writes a PNG file. -Oh, and be sure to call <tt>r.dev_off</tt> before using the file -- that will -flush any unwritten data. - -<h3>The End</h3> - -I'm afraid at this point we've exhausted my knowledge of R -programming. The next place to go is the <a -href="http://cran.r-project.org/doc/rpys/R-intro.pdf">R-intro</a>, -a short and readable introduction to using R. You can skip right to -the plotting section and use most of those commands directly from -Python, as above. - -<p> -Hope that helps! -<hr> -<i>Titus Brown [EMAIL PROTECTED]</i> - - - <!-- END INCLUDE DATA HERE --> - <!-- END Central section --> - </td> - <td class="right"> - <!-- News table --> - <table class="box"> - <tbody> - <tr> - <td> - <div class="header"> - <strong>News</strong> - </div> - <ul class="menu"> - <li><a href="news.html"> - RPy 1.0 RC 3 now available</a><br> - <i>(2007-06-26)</i><br> <br> - </li> - - <li><a href="news.html"> - RPy 0.99.0 now available</a><br> - <i>(2006-03-15)</i><br> <br> - </li> - <li><a href="news.html"> - RPy now using Subversion</a><br> - <i>(2006-02-28)</i><br> <br> - </li> - <li><a href="news.html"> - RPy 0.4.6 now available</a><br> - <i>(2005-07-28)</i><br> <br> - </li> - <li><a href="news.html"> - RPy 0.4.5 now available</a><br> - <i>(2005-07-25)</i><br> <br> - </li> - <li><a href="news.html"> - RPy 0.4.4 now available</a><br> - <i>(2005-07-23)</i><br> <br> - </li> - <li><a href="news.html"> - RPy 0.4.3 now available</a><br> - <i>(July 20, 2005)</i><br> <br> - </li> - <li><a href="news.html"> - RPy 0.4.2 now available</a><br> - <i>(May 23, 2004)</i><br> <br> - </li> - </td> - </tr> - </tbody> - </table> - <!-- END News table --> - - <br> - </td> - </tr> - </tbody> - </table> - <!-- END Document table --> - - </body> -</html> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone _______________________________________________ rpy-list mailing list rpy-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rpy-list