Commit 100628dd authored by panos's avatar panos Committed by Jérome Perrin

Insert Barplot in Plots script

parent 8db51226
...@@ -48,15 +48,15 @@ class Graphs: ...@@ -48,15 +48,15 @@ class Graphs:
rdev=robjects.r['dev.off'] rdev=robjects.r['dev.off']
rjpeg=robjects.r['jpeg'] rjpeg=robjects.r['jpeg']
output=rjpeg(fileName) #Graph data samples and define color and type for the data points visualization output=rjpeg(fileName)
rplot(data1,data2,main='Scatterplot',xlab="data1", ylab='data2',pch=19) rplot(data1,data2,main='Scatterplot',xlab="data1", ylab='data2',pch=19) #Graph data samples and define type for the data points visualization
rdev rdev
return output return output
def Histogram(data,fileName="histogram.jpg"): def Histogram(self,data,fileName="histogram.jpg"):
data=robjects.FloatVector(data) #The given lists change into float vector in order to be handled by RPy2 data=robjects.FloatVector(data) #The given list change into float vector in order to be handled by RPy2
rhist=robjects.r['hist'] rhist=robjects.r['hist'] #Call hist function - R function
rdev=robjects.r['dev.off'] rdev=robjects.r['dev.off']
rjpeg=robjects.r['jpeg'] rjpeg=robjects.r['jpeg']
output=rjpeg(fileName) output=rjpeg(fileName)
...@@ -65,6 +65,18 @@ class Graphs: ...@@ -65,6 +65,18 @@ class Graphs:
rdev rdev
return output return output
def Barplot(data,fileName="barplot.jpg"):
data=robjects.FloatVector(data) #The given list changes into float vector in order to be handled by RPy2
rbarplot=robjects.r['barplot'] #Call barplot - R function
rdev=robjects.r['dev.off']
rjpeg=robjects.r['jpeg']
output=rjpeg(fileName)
rbarplot(data, main='Barplot',border='blue') #Create a bar plot for the given data sample
rdev
return output
def Pie(self, data1, fileName="pieChart.jpg"): def Pie(self, data1, fileName="pieChart.jpg"):
data1=robjects.FloatVector(data1) #The given list changes into float vector in order to be handled by RPy2 data1=robjects.FloatVector(data1) #The given list changes into float vector in order to be handled by RPy2
rpaste=robjects.r['paste'] #Call paste - R function rpaste=robjects.r['paste'] #Call paste - R function
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment