Error No Layers In Plot
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more
Error No Layers In Plot Ggplot R
about Stack Overflow the company Business Learn more about hiring developers or posting error no layers in plot ggplot2 ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack
Error No Layers In Plot In R
Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up “Error: No layers in plot” when using ggplot up vote 3 error no layers in plot ggplot down vote favorite 2 I got a simple data.frame (AD0) with basic statistical values and the factor(group): mean se sd median group value1 0.725 0.07149951 0.4522026 1 1 value2 0.650 0.07637626 0.4830459 1 2 value3 0.175 0.06084343 0.3848076 0 3 value4 0.375 0.07752171 0.4902903 0 4 I tried to make a simple barplot with: p <- ggplot(AD0, aes(mean,group)) + geom_bar() However, I get the message: "Error: No layers in error could not find function multiplot plot" It is such a simple thing and I can't get my head around why its not working. I would be really glad if somebody could help me r ggplot2 share|improve this question edited Nov 29 '12 at 5:20 mnel 69k8162173 asked Nov 25 '12 at 20:07 DUWUDA 75211 1 I get a different error, but in any case, try adding stat = "identity" to geom_bar. –joran Nov 25 '12 at 20:14 add a comment| 1 Answer 1 active oldest votes up vote 8 down vote accepted Since you have presummarised data, you need to specify stat = "identity" in geom_bar. library(ggplot2) ggplot(AD0, aes(group, mean)) + geom_bar(stat = "identity") Furthermore, I suppose you want to use group for the x-axis and mean for the y-axis. I switched the order of both names. share|improve this answer edited Nov 25 '12 at 20:29 answered Nov 25 '12 at 20:19 Sven Hohenstein 50.6k85482 thanks a lot!!!! –DUWUDA Nov 25 '12 at 20:28 add a comment| Your Answer draft saved draft discarded Sign up or log in Sign up using Google Sign up using Facebook Sign up using Email and Password Post as a guest Name Email Post as a guest Name Email discar
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company
Could Not Find Function Ggplot
Business Learn more about hiring developers or posting ads with us Stack Overflow Questions ggplot env is missing Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million
Discrete Value Supplied To Continuous Scale
programmers, just like you, helping each other. Join them; it only takes a minute: Sign up ggplot - error: no layers in plot up vote 0 down vote favorite I am having a real hard time with http://stackoverflow.com/questions/13554980/error-no-layers-in-plot-when-using-ggplot ggplot function! I try to briefly explain my problem. I have a dataset of several tweets associated to a time stamp; I would like to plot the data obtaining a graph with time on the x bar and the frequency or the "tweet-rate" per hour on the y axis. What did I do? library(ggplot2) c4l.tweets <- read.csv("/Users/vincenzo/Desktop/Collect %23c4l13 Tweets - Archive.csv") c4l.tweets$time <- as.POSIXct(strptime(c4l.tweets$time, "%d/%m/%Y %H:%M:%S", tz="CST") - 6*60*60) library(chron) c4l.tweets$by.hour <- trunc(c4l.tweets$time, units="hours") http://stackoverflow.com/questions/20831298/ggplot-error-no-layers-in-plot ggplot(count(c4l.tweets, "by.hour"), aes(x=by.hour, y=freq)) + geom_bar(stat="identity") + xlab("Number") + ylab("Date") + labs(title="tweets by hour") So basically I truncated the data by the timestamp and used the count function to plot them. I get the Error: No layers in plot and Error in +geom_bar(stat = "identity") : argument not valid for the operator But why? what am I doing wrong? I usually have this problem each time i try to plot something via ggplot, what do I do wrong? Thank you! Vincenzo r ggplot2 share|improve this question asked Dec 29 '13 at 23:33 user3103007 714 5 don't break the line before the + ... or put parentheses around the whole expression to stop R interpreting the ggplot() call before you get a chance to add geoms to it. –Ben Bolker Dec 29 '13 at 23:42 omg stupid :(. thank you ! –user3103007 Dec 30 '13 at 0:21 1 you are encouraged to post an answer to your own question based on this hint (you may have to wait another hour or so before you're allowed to) –Ben Bolker Dec 30 '13 at 0:23 there are similar questions: stackoverflow.com/questions/15388748/… but I don't think they're exact duplicates. –Ben Bolker Dec 30 '13 at 0:24 add a comment| active oldest votes Know someone who can answer? Sha
von GoogleAnmeldenAusgeblendete FelderNach Gruppen oder Nachrichten suchen