I ran a program with different threads in two configurations a
and b
. I breakdown its timings into btime
, stime
, and vtime
. Please see below for the data. I need to draw stacked plot as you can see below. However, I face difficulty in representing both the number of threads and configs as x-axis labels in R. Could some one help to produce a better representation of this data in terms of stacked plots in R please. Please see the figure and the R code I am using below.
Data:
config threads btime stime vtime
a 2 0.08 0.32 0.09
b 2 0.32 0.19 0.16
a 4 3.72 2841.13 0.22
b 4 18.21 2865.79 5.12
a 8 5.45 2824.46 4.77
b 8 23.27 2790.14 11.89
a 16 57.63 3302.55 94.25
b 16 62.41 4041.19 82.56
a 32 119.08 3705.62 210.14
b 32 183.01 4411.14 234.17
a 64 211.51 2823.69 270.38
b 64 364.38 4091.97 387.83
R code
> barplot(t(data1[c(3:5)]), ylab="Time(seconds)", sp=c(0.1, 0.2, 1.0, 0.2, 1.0, 0.2, 1.0, 0.2, 1.0, 0.2, 1.0, 0.2),col=c("white","gray20","gray60"))
> legend("topleft",legend=c("btime","stime","vtime"), bty="n",cex=1.5 , horiz=T, adj=0.2, fill=c("white","gray20","gray60"))
ggplot and lattice are very helpful here, however it is useful to think of the data in a different manner: you will want to represent it as something like
config threads time_type time_value
[...] [...] vtime 0.03
melt from reshape accomplishes this (see tutorial http://www.statmethods.net/management/reshape.html )
Then, you can do a plot of something like... qplot(config, time_value, data=data, group=time_type, fill=time_type, geom="barplot", facets= .~threads)
(tutorial @ http://www.r-bloggers.com/basic-introduction-to-ggplot2/ )
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.