質問

I have this code in R:

p <- ggplot(data, aes(x = Price, y = ActionsCount))
p + geom_point(alpha = 0.25, aes(color = Medium))
p + coord_cartesian(xlim=c(0,300), ylim=c(0,40))
p + facet_wrap( ~ Medium)

And the console returns: No layers in plot

If I launched only the first two rows, a chart is plotted.But if I want to run all the code, there is the error no layers in plot after processing coord_cartesian command and alse after processing p + facet_wrap( ~ Medium).

Data are loaded by sqldf:

data <- sqldf("SELECT User.V1 as Id, User.V7 as Source, User.V8 as Medium, CAST(User.V3 as Int) as Price, count(*) as ActionsCount FROM User)

Thank you for your help.

役に立ちましたか?

解決

You're not updating p every time.

p <- p + geom_point(...
p <- p + coord_cartesian(...
p <- p + facet_wrap(...
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top