ggplot2 - 错误消息“提供给连续比例的离散值”

时间:2013-07-24 11:40:17

标签: r ggplot2

当我尝试绘制图形时(通过使用ggplot2),我总是收到以下错误消息: “提供给连续规模的离散价值”

我的代码出了什么问题?

这是我的代码:

F1 <- 
  ggplot(MCGDP_T, aes(x=Year),xlab("Year")) + 
  geom_line(aes(y=Argentina, colour="Argentina")) +
  geom_line(aes(y=Australia, colour="Australia")) +
  geom_line(aes(y=Austria, colour="Austria")) +
  xlab("Year") +
  ylab("% of GDP") +
  scale_colour_discrete(guide = guide_legend(title = NULL)) +
  theme(panel.background = element_rect(fill="#F9F9F9", colour="black")) +
  theme(panel.grid.major = element_line(colour = "#6A6A6A", linetype = "dashed")) +
  theme(panel.grid.minor = element_line(colour = "white")) +
  theme(legend.key = element_rect(fill = "transparent")) +
  theme(legend.key.size = unit(0.8, "cm")) +
  theme(legend.text = element_text(size=12, family="Georgia")) +
  theme(legend.justification=c(0,1), legend.position=c(0,1)) +
  theme(legend.background = element_rect(fill="white", colour="black")) +
  theme(axis.title.x = element_text(colour="black", size=12, family="Georgia")) +
  theme(axis.title.y = element_text(colour="black", size=12, family="Georgia")) +
  theme(axis.text.x = element_text(size=10, family="Georgia")) +
  theme(axis.text.y = element_text(size=10, family="Georgia")) +
  scale_x_continuous(breaks=seq(1988, 2012, 3)) +
  scale_y_continuous(breaks=round(seq(min(MCGDP_T$Argentina, MCGDP_T$Australia, MCGDP_T$Austria), max(MCGDP_T$Argentina, MCGDP_T$Australia, MCGDP_T$Austria), by = 20),0)) +
  theme(plot.margin = unit(c(-0.3, 0.2, 0, 0), "cm")) +
  ggtitle("") 

grid.arrange(F1)

0 个答案:

没有答案