0

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.

1 Answer 1

5

You're not updating p every time.

p <- p + geom_point(...
p <- p + coord_cartesian(...
p <- p + facet_wrap(...
1
  • Thanks. I'm a novice and i'm exploring the syntax now:)) Dec 19, 2013 at 17:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.