I am trying to arrange graphs in a 2x2 grid layout with year on the X axis and Cost on the Y axis. When I format by individual graph my formatting, namely the dollar sign is there, but when I arrange it in the grid layout the dollar sign and commas disappear.
Code below:
rat<-qplot(tallc$Group.1,COSTS,data=tallc, geom=c("point","smooth"),
method="lm",
xlab= "YEAR",
ylab= "COST",
scale_x_continuous(limits = c(1999,2012)),
main= "Total Costs from 1999 to 2012")
rat1 <- rat+scale_x_continuous(breaks=c(1999,2000,2001,2002,2003,2004,2005,2006,
2007,2008,2009,2010,2011,2012))
rat1 + scale_y_continuous(labels=dollar)
the moment I use
pushViewport(viewport(layout = grid.layout(2, 2)))
print(a, vp = viewport(layout.pos.row = 1, layout.pos.col = 1))
print(b, vp = viewport(layout.pos.row = 1, layout.pos.col = 2))
print(c, vp = viewport(layout.pos.row = 2, layout.pos.col = 1))
print(rat1, vp = viewport(layout.pos.row = 2, layout.pos.col = 2))
Dollar sign disappears.