Added another example with complete files.
[docutils/kirr.git] / sandbox / docbook / examples / report2 / charts / static_picking_compared.R
blobeef72d58139aae7aba37e64d92dc4354cffc456d
1 rates <- read.csv("../tables/all.csv")\r
2 x = rates$week\r
3 png(file="static_vs_other.png", width=width, height=7, units="in", res=res)\r
4 # first graph\r
5 make.title <- T\r
6 y = rates$rate.outbound.2011\r
7 y_range <- range(y, na.rm=T)\r
8 title = "Outbound Rate over Time"\r
9 par(mfrow=c(3,1)) \r
10 xlab.text="week in year"\r
11 xlab = xlab.text\r
12 ylab = "units/man hour"\r
13 if (make.title == T ) top.margin = 3\r
14 if (make.title != T ) title="" \r
15 if (months.grid == T) bottom.margin = 6\r
16 if (months.grid == T) xlab = ''\r
17 margins=c(bottom.margin, 4, top.margin, 0.5) \r
18 par(mar=margins) \r
19 par('family'='serif')\r
20 plot(x, type='n', xlab=xlab, ylab=ylab, las=1, main=title, ylim=c(y_range), axes=F)\r
21 axis(1, col=ax_col)\r
22 axis(2, col=ax_col, las=1, at=axTicks(2))\r
23 box(col=box_col)\r
24 abline( h=axTicks(2), lty=1, lwd=lwd_grid, col=ax_col)\r
25 lines(x,y,  col=line_colors[2], type="l", lwd=lwd, lty=line_types[2])\r
26 source("make_x_axis.R")\r
30 rm(y)\r
32 title = "Static Rate,  2011"\r
33 x = rates$week\r
34 y = rates$rate.static.picking.2011\r
35 y_range <- range(y, na.rm=T)\r
36 xlab.text="week in year"\r
37 xlab = xlab.text\r
38 ylab = "units/man hour"\r
39 if (make.title == T ) top.margin = 3\r
40 if (make.title != T ) title="" \r
41 if (months.grid == T) bottom.margin = 6\r
42 if (months.grid == T) xlab = ''\r
43 margins=c(bottom.margin, 4, top.margin, 0.5) \r
44 par(mar=margins) \r
45 par('family'='serif')\r
46 plot(x, type='n', xlab=xlab, ylab=ylab, las=1, main=title, ylim=c(y_range), axes=F)\r
47 axis(1, col=ax_col)\r
48 axis(2, col=ax_col, las=1, at=axTicks(2))\r
49 box(col=box_col)\r
50 abline( h=axTicks(2), lty=1, lwd=lwd_grid, col=ax_col)\r
51 lines(x,y,  col=line_colors[2], type="l", lwd=lwd, lty=line_types[2])\r
52 source("make_x_axis.R")\r
54 # second chart\r
56 # third chart\r
57 # other\r
59 total.units = rates$units.singles.2011 + rates$units.multis.2011 +\r
60  rates$units.car.pick.2011 + rates$units.shipping.2011\r
61 total.hours = rates$hours.singles.2011 + rates$hours.multis.2011 +\r
62  rates$hours.car.pick.2011 + rates$hours.shipping.2011\r
63 other.rate <- total.units/total.hours\r
65 title = "Other Rates,  2011"\r
66 x = rates$week\r
67 y = other.rate\r
68 y_range <- range(y, na.rm=T)\r
69 xlab.text="week in year"\r
70 xlab = xlab.text\r
71 ylab = "units/man hour"\r
72 if (make.title == T ) top.margin = 3\r
73 if (make.title != T ) title="" \r
74 if (months.grid == T) bottom.margin = 6\r
75 if (months.grid == T) xlab = ''\r
76 margins=c(bottom.margin, 4, top.margin, 0.5) \r
77 par(mar=margins) \r
78 par('family'='serif')\r
79 plot(x, type='n', xlab=xlab, ylab=ylab, las=1, main=title, ylim=c(y_range), axes=F)\r
80 axis(1, col=ax_col)\r
81 axis(2, col=ax_col, las=1, at=axTicks(2))\r
82 box(col=box_col)\r
83 abline( h=axTicks(2), lty=1, lwd=lwd_grid, col=ax_col)\r
84 lines(x,y,  col=line_colors[2], type="l", lwd=lwd, lty=line_types[2])\r
85 source("make_x_axis.R")\r
88 dev.off()\r