Added another example with complete files.
[docutils/kirr.git] / sandbox / docbook / examples / report2 / charts / outbound_2010_2011.R
blob9764a0309edd1045ba5230a61d40b788e3d481a8
1 rates <- read.csv("../tables/all.csv")\r
2 x = rates$week\r
3 y1 = rates$rate.outbound.2010\r
4 y2 = rates$rate.outbound.2011\r
5 title=''\r
6 y_range <- range(y1, y2, na.rm=T)\r
7 png(file="outbound_rate_2010_2011.png", width=width,\r
8 height=3.5, units="in", res=res)\r
9 xlab.text="week in year"\r
10 xlab = xlab.text\r
11 ylab = "units/man hour"\r
12 if (make.title == T ) top.margin = 3\r
13 if (make.title != T ) title="" \r
14 if (months.grid == T) bottom.margin = 6\r
15 if (months.grid == T) xlab = ''\r
16 margins=c(bottom.margin, 4, top.margin, 0.5) \r
17 par(mar=margins) \r
18 par('family'='serif')\r
19 plot(x, type='n', xlab=xlab, ylab=ylab, las=1, main=title, ylim=c(y_range), axes=F)\r
20 axis(1, col=ax_col)\r
21 axis(2, col=ax_col, las=1, at=axTicks(2))\r
22 box(col=box_col)\r
23 abline( h=axTicks(2), lty=1, lwd=lwd_grid, col=ax_col)\r
24 lines(x,y1,  col=line_colors[1], type="l", lwd=lwd, lty=line_types[1])\r
25 lines(x,y2, type="l", col=line_colors[2], lwd=lwd, lty=line_types[2])\r
26 legend("bottomleft", c("2010","2011"), cex=legend_font_size, \r
27  col=line_colors,  lty=line_types, bty='y', bg="white", box.lwd=box.lwd)\r
28 source("make_x_axis.R")\r
29 dev.off()\r