Discussion:
non-numeric argument to binary operator
Sean Simpson
2018-03-19 19:09:07 UTC
Permalink
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.
--
--
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 ***@googlegroups.com
To unsubscribe: email ggplot2+***@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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Ista Zahn
2018-03-19 19:37:29 UTC
Permalink
plot ==> ggplot

--Ista
Post by Sean Simpson
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)) +
non-numeric argument to binary operator
Any help is appreciated.
--
--
You received this message because you are subscribed to the ggplot2 mailing list.
https://github.com/hadley/devtools/wiki/Reproducibility
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
For more options, visit https://groups.google.com/d/optout.
--
--
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 ***@googlegroups.com
To unsubscribe: email ggplot2+***@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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Sean Simpson
2018-03-19 19:45:58 UTC
Permalink
brilliant, thank you
Post by Ista Zahn
plot ==> ggplot
--Ista
Post by Sean Simpson
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
Post by Sean Simpson
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))
+
Post by Sean Simpson
non-numeric argument to binary operator
Any help is appreciated.
--
--
You received this message because you are subscribed to the ggplot2
mailing
Post by Sean Simpson
list.
https://github.com/hadley/devtools/wiki/Reproducibility
More options: http://groups.google.com/group/ggplot2
---
You received this message because you are subscribed to the Google
Groups
Post by Sean Simpson
"ggplot2" group.
To unsubscribe from this group and stop receiving emails from it, send
an
Post by Sean Simpson
For more options, visit https://groups.google.com/d/optout.
--
--
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 ***@googlegroups.com
To unsubscribe: email ggplot2+***@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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Sean Simpson
2018-03-19 19:56:31 UTC
Permalink
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
Post by Ista Zahn
plot ==> ggplot
--Ista
Post by Sean Simpson
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
Post by Sean Simpson
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))
+
Post by Sean Simpson
non-numeric argument to binary operator
Any help is appreciated.
--
--
You received this message because you are subscribed to the ggplot2
mailing
Post by Sean Simpson
list.
https://github.com/hadley/devtools/wiki/Reproducibility
More options: http://groups.google.com/group/ggplot2
---
You received this message because you are subscribed to the Google
Groups
Post by Sean Simpson
"ggplot2" group.
To unsubscribe from this group and stop receiving emails from it, send
an
Post by Sean Simpson
For more options, visit https://groups.google.com/d/optout.
--
--
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 ***@googlegroups.com
To unsubscribe: email ggplot2+***@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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
t***@uni-bremen.de
2018-03-19 20:02:41 UTC
Permalink
Look at geom_abline with arguments for intercept and slope:
http://ggplot2.tidyverse.org/reference/geom_abline.html
Post by Sean Simpson
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
Post by Ista Zahn
plot ==> ggplot
--Ista
Post by Sean Simpson
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
Post by Sean Simpson
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))
+
Post by Sean Simpson
non-numeric argument to binary operator
Any help is appreciated.
--
--
You received this message because you are subscribed to the ggplot2
mailing
Post by Sean Simpson
list.
https://github.com/hadley/devtools/wiki/Reproducibility
More options: http://groups.google.com/group/ggplot2
---
You received this message because you are subscribed to the Google
Groups
Post by Sean Simpson
"ggplot2" group.
To unsubscribe from this group and stop receiving emails from it, send
an
Post by Sean Simpson
For more options, visit https://groups.google.com/d/optout.
--
--
--
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 ***@googlegroups.com
To unsubscribe: email ggplot2+***@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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...