Added another example with complete files.
[docutils/kirr.git] / sandbox / docbook / examples / report2 / charts / predicted_costs_returns.R
blobd9c92435c12eb67fdc08accef015410949e02747
1 data = read.csv("../tables/projected_rates_returns.csv")
2 attach(data)
3 x <- c(1:12)
4 title <- 'Predicted Rate of Returns, 2012'
5 y1 <- Rate.Zappos
6 y2 <- Rate.FCSW
7 png(file="projected_rate_returns.png", width=5,
8 height=3.5, units="in", res=res)
9 xlab.text="month"
10 xlab = xlab.text
11 ylab = "units/man hour"
12 if (make.title == T ) top.margin = 3
13 if (make.title != T ) title="" 
14 margins=c(bottom.margin, 4, top.margin, 0.5) 
15 par(mar=margins) 
16 par('family'='serif')
17 y_range = range(y1, y2, na.rm=T)
18 plot(x, type='n', xlab=xlab, ylab=ylab, las=1, main=title, ylim=c(y_range), axes=F)
19 at = c(1,2,3,4,5,6,7,8,9,10,11,12)
20 axis(1, at=at, labels=months, col=ax_col, lab=NULL)  
21 axis(2, col=ax_col, las=1, at=axTicks(2))
22 box(col=box_col)
23 abline( h=axTicks(2), lty=1, lwd=lwd_grid, col=ax_col)
24 lines(x,y1,  col=line_colors[1], type="l", lwd=lwd, lty=line_types[1])
25 lines(x,y2, col=line_colors[2],  lwd=lwd, lty=line_types[2])
26 legend("bottomleft", c("Zappos","FCSW"), cex=legend_font_size, 
27  col=line_colors,  lty=line_types, bty='y', bg="white", box.lwd=box.lwd)
28 dev.off()