non-numeric argument to binary operator

485 views
Skip to first unread message

Sean Simpson

unread,
Mar 19, 2018, 3:12:18 PM3/19/18
to ggplot2
I get this error when trying to plot: 

plot(SG, aes(fill=AGE, y=OC, x=AGE)) + 
  geom_blank() + theme_bw() +
  theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank()) +
  geom_bar(position="dodge", stat="identity", colour="black", size=.3) + 
  geom_errorbar(aes(ymin=OC-SE, ymax=OC+SE), width=.1, size=.1, # Width of the error bars
                position=position_dodge(0)) +
      xlab("Crop Age") + ylab("SOC (%)") + ggtitle("") + expand_limits(y=c(NA, 4.5))

the error message is: Error in plot(SG, aes(fill = AC, y = OC, x = AC)) + geom_blank() : 
  non-numeric argument to binary operator

Any help is appreciated.

Ista Zahn

unread,
Mar 19, 2018, 3:38:56 PM3/19/18
to Sean Simpson, ggplot2
plot ==> ggplot

--Ista
> --
> --
> You received this message because you are subscribed to the ggplot2 mailing
> list.
> Please provide a reproducible example:
> https://github.com/hadley/devtools/wiki/Reproducibility
>
> To post: email ggp...@googlegroups.com
> To unsubscribe: email ggplot2+u...@googlegroups.com
> More options: http://groups.google.com/group/ggplot2
>
> ---
> You received this message because you are subscribed to the Google Groups
> "ggplot2" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ggplot2+u...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Sean Simpson

unread,
Mar 19, 2018, 3:45:58 PM3/19/18
to ggplot2
brilliant, thank you

Sean Simpson

unread,
Mar 19, 2018, 3:56:31 PM3/19/18
to ggplot2
A follow-up question now that you have resolved this issue. I am trying to draw multiple linear regressions on this plot. I have the equations that I want to draw but not sure how to do this. I have read a few other threads on here and still unsure where to start.

plot(SG, aes(fill=AGE, y=OC, x=AGE)) + 
  geom_blank() + theme_bw() +
  theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank()) +
  geom_bar(position="dodge", stat="identity", colour="black", size=.3) + 
  geom_errorbar(aes(ymin=OC-SE, ymax=OC+SE), width=.1, size=.1, # Width of the error bars
                position=position_dodge(0)) +
      xlab("Crop Age") + ylab("SOC (%)") + ggtitle("") + expand_limits(y=c(NA, 4.5))

The two equations that I want to plot are: y=0.08x + 1.54 and y=0.03x + 2.79.

Any help is appreciated.

- Sean

On Monday, March 19, 2018 at 3:38:56 PM UTC-4, Ista Zahn wrote:

tric...@uni-bremen.de

unread,
Mar 19, 2018, 4:03:07 PM3/19/18
to ggp...@googlegroups.com
Look at geom_abline with arguments for intercept and slope:
http://ggplot2.tidyverse.org/reference/geom_abline.html


Zitat von Sean Simpson <sean.s...@gmail.com>:
>> > To post: email ggp...@googlegroups.com <javascript:>
>> > To unsubscribe: email ggplot2+u...@googlegroups.com <javascript:>
>> > More options: http://groups.google.com/group/ggplot2
>> >
>> > ---
>> > You received this message because you are subscribed to the Google
>> Groups
>> > "ggplot2" group.
>> > To unsubscribe from this group and stop receiving emails from it, send
>> an
>> > email to ggplot2+u...@googlegroups.com <javascript:>.
>> > For more options, visit https://groups.google.com/d/optout.
>>
>
> --



Reply all
Reply to author
Forward
0 new messages