def asR(self,plot_pdf=os.getcwd()+"/out.pdf"):
        # Create a file object for output
        f = StringIO.StringIO()
        
        # Generate Configuration
        f.write("# This is an R script that will generate a plot.\n")
        f.write("# These first few lines are configuration options.\n")
        f.write("filename='%s';\n"%plot_pdf)
        f.write("plot_width=6; # width in inches\n")
        f.write("plot_height=6; # height in inches\n")
        f.write("title='%s'\n"%self.title)
        f.write("xlabel='%s'\n"%self.xlabel)
        f.write("ylabel='%s'\n"%self.ylabel)
        f.write("xrange=c(%f,%f)\n"%self.range()[:2])
        f.write("yrange=c(%f,%f)\n"%self.range()[2:])
        f.write("\n")
        f.write("\n")
        f.write("\n")
        f.write("\n")
        
        # Create the plot
        f.write("pdf(file=filename,width=plot_width,height=plot_height)\n")
        f.write("\n")
        f.write("par(mai=c(0.5,0.5,0.5,0.1)) # minimal inner margin\n")
        f.write("par(mgp=c(1.5,0.5,0.0)) # small axes label spacing\n")
        f.write("\n")
        f.write("plot(xrange,yrange,type='n',main=title,xlab=xlabel,ylab=ylabel)\n")
        f.write("# Log scale...\n")
        f.write("# Custom axis...\n")
        f.write("\n")
        
        # Generate stubs for common plot additions such as labels.
        f.write("\n")
        f.write("# axis(1,at=c(1,3,4),labels =c(1,3,4)) # xaxis.  Also add xaxt='n' to the plot command.\n")
        f.write("# axis(2,at=c(1,3,4),labels =c(1,3,4)) # yaxis.  Also add yaxt='n' to the plot command.\n")
        f.write("# legend('topright',c('Label 1','Label 2')),fill=c('blue','green'))\n")
        f.write("\n")
        
        # Render the data
        for each in self.graphics:
            f.write("# DRAWING: %s\n"%(each.__class__))
            each.drawR(f)
            f.write("\n")
            #print each

        # Finish up
        f.write("dev.off()\n")
        f.write("\n")
        f.write("\n")

        f.flush()
        
        p_in,p_out = os.popen2("R --no-save")
        p_in.write(f.getvalue())
        p_in.close()
        print p_out.read()
        p_out.close()
        
        return f.getvalue()
Creating a new SourceRepository object should create a new repository
dataset/ETHPy150Open bolme/pyvision/src/pyvision/analysis/plot.py/Plot.asR--crossover with--dataset/ETHPy150Open washingtontimes/django-repositories/repositories/tests.py/SourceRepositoryTestCase.testNewPublicRepo