diff scatterplot.py @ 1:b4102b163488 draft

planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/scatterplot commit 1b68ca3d083c5879e996a9df5e22963dfc9c3f90-dirty
author mvdbeek
date Wed, 14 Sep 2016 12:42:56 -0400
parents 11627baf830e
children
line wrap: on
line diff
--- a/scatterplot.py	Wed Sep 14 12:40:20 2016 -0400
+++ b/scatterplot.py	Wed Sep 14 12:42:56 2016 -0400
@@ -4,7 +4,12 @@
 import sys
 
 from numpy import array
-from rpy import r
+import rpy2.rpy_classic as rpy
+from rpy2.robjects.numpy2ri import numpy2ri
+
+
+rpy.set_default_mode(rpy.NO_CONVERSION)
+r = rpy.r
 
 
 def stop_err(msg):
@@ -65,8 +70,9 @@
 
     if skipped_lines < i:
         try:
+            a = numpy2ri(array( matrix ))
             r.pdf( out_fname, 8, 8 )
-            r.plot( array( matrix ), type="p", main=title, xlab=xlab, ylab=ylab, col="blue", pch=19 )
+            r.plot( a, type="p", main=title, xlab=xlab, ylab=ylab, col="blue", pch=19 )
             r.dev_off()
         except Exception, exc:
             stop_err( "%s" % str( exc ) )
@@ -77,7 +83,5 @@
     if skipped_lines > 0:
         print "Skipped %d lines starting with line #%d, value '%s' in column %d is not numeric." % ( skipped_lines, first_invalid_line, invalid_value, invalid_column )
 
-    r.quit( save="no" )
-
 if __name__ == "__main__":
     main()