尽管有+ geom_line(),但图表中没有线 [英] No line in plot chart despite + geom_line()
本文介绍了尽管有+ geom_line(),但图表中没有线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经阅读了文档,我认为我的代码应该是正确的,但是输出中的两点之间仍然没有任何界限.怎么了?
I've read documentation and I think that my code should be right, but still there is no line between the points in the output. What is wrong?
x'轴是离散的,y'轴是连续的.
The x'axis is discrete and y'axis is continuous.
我的代码
point.sqrmPrice <- ggplot(overview.df, aes(x = areaSize, y = sqrmPrice)) +
geom_line() +
geom_point() +
scale_y_continuous(breaks = c(seq(min(overview.df$sqrmPrice), max(overview.df$sqrmPrice), by = 10000) )) +
theme_bw()
推荐答案
您没有得到一行,因为areaSize
是一个因素.用
You are not getting a line because areaSize
is a factor. Convert to numeric with
overview.df$areaSize <- as.numeric(as.character(overview.df$areaSize))
然后进行绘制.
这篇关于尽管有+ geom_line(),但图表中没有线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文