Long-standing issues with finding x,y, variables using ggplot2

102 views
Skip to first unread message

The-plotter

unread,
Mar 2, 2012, 3:47:15 PM3/2/12
to ggplot2
See below - two numeric variables in a dataframe named ITERDATA. It
works in qplot. It doesn't work in qqplot,
even with attaching the data to the local environment and specifying
the dataframe within aes. Please advise.

> ggplot(ITERDATA, aes(x = NEW_PSTOCK, y = Pop_trends), geom='point')
Error: No layers in plot
> attach(ITERDATA)
> qplot(NEW_PSTOCK, Pop_trends); # works
> ggplot(ITERDATA, aes(x = NEW_PSTOCK, y = Pop_trends), geom='point'); # doesn't work
Error: No layers in plot
> ggplot(aes(x = ITERDATA$NEW_PSTOCK, y = ITERDATA$Pop_trends), geom='point'); # doesn't work
Error: ggplot2 doesn't know how to deal with data of class uneval
> summary(NEW_PSTOCK)
Min. 1st Qu. Median Mean 3rd Qu. Max.
0.0 0.0 0.5 0.5 1.0 1.0
> summary(Pop_trends)
Min. 1st Qu. Median Mean 3rd Qu. Max.
0.8412 0.9995 1.0100 1.0100 1.0200 1.0660
> qplot(NEW_PSTOCK, Pop_trends); # works
> search()
[1] ".GlobalEnv" "ITERDATA" "package:ggplot2"
"package:gtools" "package:gdata"
[6] "package:stats" "package:graphics" "package:grDevices"
"package:utils" "package:datasets"
[11] "package:reshape" "package:plyr" "package:grid"
"package:proto" "package:methods"
[16] "Autoloads" "package:base"
>

James McCreight

unread,
Mar 2, 2012, 4:32:42 PM3/2/12
to The-plotter, ggplot2
how about?

ggplot(ITERDATA, aes(x = NEW_PSTOCK, y = Pop_trends)) +  geom_point()



--
You received this message because you are subscribed to the ggplot2 mailing list.
Please provide a reproducible example: http://gist.github.com/270442

To post: email ggp...@googlegroups.com
To unsubscribe: email ggplot2+u...@googlegroups.com
More options: http://groups.google.com/group/ggplot2



--

******************************************************************************
James McCreight                               
cell: (831) 261-5149
VoIP (to cell): (720) 897-7546

James McCreight

unread,
Mar 2, 2012, 5:00:18 PM3/2/12
to jag...@ornl.gov, ggp...@googlegroups.com
Some people think qplot is more of a bother and confusion than anything else. I never learned it's syntax. The regular ggplot syntax is different, but not hard in anyway. Take a look at the standard examples and you'll see how to build layers by adding them on. You can also include data frames and aesthetics to each geom.

J

On Fri, Mar 2, 2012 at 2:40 PM,  <jag...@ornl.gov> wrote:

that worked.  thanks!

Reply all
Reply to author
Forward
0 new messages