Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
dream
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
dream
Commits
61a8a483
Commit
61a8a483
authored
Dec 18, 2013
by
panos
Committed by
Jérome Perrin
Jan 20, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Insert Plot to graph two data sets
parent
100628dd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
1 deletion
+30
-1
dream/simulation/outputanalysis/Plots.py
dream/simulation/outputanalysis/Plots.py
+30
-1
No files found.
dream/simulation/outputanalysis/Plots.py
View file @
61a8a483
...
...
@@ -65,7 +65,7 @@ class Graphs:
rdev
return
output
def
Barplot
(
data
,
fileName
=
"barplot.jpg"
):
def
Barplot
(
self
,
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
...
...
@@ -77,6 +77,35 @@ class Graphs:
rdev
return
output
def
TwoSetPlot
(
self
,
data1
,
data2
,
fileName
=
"twosetplot.jpg"
):
#The given lists change into float vector in order to be handled by RPy2
data1
=
robjects
.
FloatVector
(
data1
)
data2
=
robjects
.
FloatVector
(
data2
)
rplot
=
robjects
.
r
[
'plot'
]
#Call plot - R function
rdev
=
robjects
.
r
[
'dev.off'
]
rjpeg
=
robjects
.
r
[
'jpeg'
]
rlines
=
robjects
.
r
[
'lines'
]
#Call lines function - R function
rbox
=
robjects
.
r
[
'box'
]
#Call box function - R function
rrange
=
robjects
.
r
[
'range'
]
#Call range - R function
plot_colors
=
robjects
.
StrVector
([
"red"
,
"forestgreen"
])
#Define colors to be used in the plot
output
=
rjpeg
(
fileName
)
rplot
(
data1
,
xlab
=
"x"
,
ylab
=
"Total"
,
ylim
=
rrange
(
data1
,
data2
))
#Graph the first data sample and set axes' names
rlines
(
data2
)
#Graph the second data sample
# Create box around plot
rbox
()
# Graph data1 with thicker red dashed line
rlines
(
data1
,
type
=
"l"
,
lty
=
2
,
lwd
=
2
,
col
=
plot_colors
[
0
])
# Graph data2 with thicker green dotted line
rlines
(
data2
,
type
=
"l"
,
lty
=
3
,
lwd
=
2
,
col
=
plot_colors
[
1
])
rdev
return
output
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
rpaste
=
robjects
.
r
[
'paste'
]
#Call paste - R function
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment