df = data.frame(sp = data$species, cov = data$totalcover)sp is recognised together a variable of 23 level (my variety of lines) and cov as 23 numbers.Then, to construct the histogram, I"m executing this:
ggplot(df, aes(df$sp, df$cov) + geom_histogram())However, R returns the error: "Error: Mapping should be produced with aes() or aes_()."
How is this feasible if I"m already using aes? Is it probably related through the kind of the values?
I had the very same error, even if i was making use of aes(). Therefore I used "mapping" prior to aes()
ggplot()+geom_boxplot (df, mapping = aes(x= sp, y= cov))
Two mistakes: Brackets need to be closed ~ ggplot and also calling histogram come afteryou specify her data collection when you speak to ggplot ~ above df. Thus there is no need to include df$sp. Sp is enough.
You are watching: Error: mapping should be created with `aes() or `aes_()`.
This code need to work (if there is nothing wrong with your data):
ggplot(df, aes(sp, cov)) + geom_histogram()
Yes, it works . You should not use the dollar sign $ if you have specified the data already. I had actually the exact same problem and when I removed the dissension sign, it worked.
ggplot(dat1, aes(Q84, REGION, fill = Q3)) + geom_bar(stat = "Identity") + facet_grid(REGION ~ Q84)Avoid this:
ggplot(dat1, aes(dat1$Q84, dat1$REGION, to fill = Q3)) + geom_bar(stat = "Identity") + facet_grid(dat1$REGION ~ Q84)where dat1 is the name of my dataset.
ggplot(df, aes(df$sp, df$cov))+ geom_histogram()instead that
ggplot(df, aes(df$sp, df$cov) + geom_histogram())displacement of base
As an additional potential solution, I found that having library(cowplot) and also library(ggplot2) loaded at the very same time made "ggsave("test.pdf", p1)" no work.
Instead, use the cowplot syntax "save_plot("test.pdf", p1)"
Thanks for contributing solution to stack Overflow!Please be certain to answer the question. Provide details and share her research!
But avoid …Asking because that help, clarification, or responding to various other answers.Making statements based on opinion; back them increase with referrals or personal experience.
See more: 70S Quiz Game Answers All Levels, 70S Quiz Game Cheats
To find out more, see our tips on writing good answers.
post Your prize Discard
Not the answer you're feather for? Browse other questions tagged r ggplot2 or asking your own question.
site architecture / logo design © 2022 stack Exchange Inc; user contributions licensed under cc by-sa. Rev2022.1.7.41110