0

I am trying to use grid.arrangeand am thus assigning my plots to variables. Plotting my data as a scatter plot works perfectly fine.

ggplot(df, aes(x=log(x), y=log(y), color=Category))+ geom_point()

But when I assign this to a variable I get an error message

g <- ggplot(df, aes(x=log(x), y=log(y), color=Category)) + 
     geom_point()

g

Error: unexpected numeric constant in "g 1"

Why is this the case?

Best Regards Pete

PeterGerft
  • 49
  • 1
  • 7
  • 2
    Does it persist in a fresh R-session? I could not replicate your error with sample data. If it persists in a new R-session, can you post a dput of the data? – Heroka Nov 25 '15 at 09:25
  • I made 2 changes: I replaced my ΓΏ with y in "Category" and set up a dataframe only with the needed data `tempframe=data.frame(Category=df$Category, x=df$x, y=df$y, stringsAsFactors = F)` and it works – PeterGerft Nov 25 '15 at 10:12
  • 1
    Good that it works. For any future questions, consider reading up on how to create a [reproducible example in R](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example), makes it easier for others to help you. – Heroka Nov 25 '15 at 11:36

0 Answers0