3
功能scale_y_continuous(expand=c(0,0))
去除利润率是给我的错误:试图在GGPLOT2可视化
Error: Discrete value supplied to continuous scale
我真不明白这是什么意思。该功能被称为scale_y_continuous
,而不是scale_y_discrete
。 Here's my data。
require(ggplot2) # ggplot
gp <- read.csv("Retail_Gas_Prices.csv")
gp$Date <- as.Date(substr(gp$Date, 1, 10), "%m/%d/%Y")
gp_melted <- melt(gp, id = "Date")
gas_ml_plot <- ggplot(subset(gp_melted, variable != "Weekly.US"),
aes(Date, value, colour = variable)) +
geom_line() + ggtitle("Retail Gas Prices In The US") +
theme(axis.title.x = element_blank()) +
ylab("Cost in Dollars") +
theme(axis.ticks = element_blank()) +
labs(colour = "US Region") +
scale_color_discrete(labels = c("East Coast", "Midwest",
"Gulf Coast", "Rocky Mountain", "West Coast")) +
theme(legend.background = element_blank()) +
theme(legend.position = c(0, 1)) +
theme(legend.justification = c(0, 1)) +
scale_y_continuous(expand = c(0, 0)) +
scale_x_discrete(expand = c(0, 0))
提交了一个描述此问题的错误报告谢谢Ista!我们可以将你编译成ggplot2的某种人类代码扩展,以便我可以得到有用的错误吗? :P – KFunk 2013-03-17 00:27:22
哈哈,@KFunk我想不出让它自动化的方法,只是继续张贴在SO上,我会尽我所能。 – Ista 2013-03-17 00:30:13