我正在尝试以 2x2 网格布局排列图表,X 轴为年份,Y 轴为成本。当我按单个图形格式化时,我的格式,即美元符号在那里,但是当我在网格布局中排列它时,美元符号和逗号消失了。
下面的代码:
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)
我使用的那一刻
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))
美元符号消失。