similar to: Stacked Bar Plot in ggplot2

Displaying 20 results from an estimated 1000 matches similar to: "Stacked Bar Plot in ggplot2"

2010 Nov 07
3
help to sum up data frame
Dear All, I have a data frame like this: name ip Bsent Breceived a 1 0.00 0.00 a 2 1.43 19.83 a 1 0.00 0.00 a 2 1.00 1.00 b 1 0.00 2.00 b 3 0.00 2.00 b 2 2.00 0.00 b 2 2.00 0.00 b 1 24.40 22.72 c
2017 Jul 27
0
na.rm = T treatment by ggplot2's geom_bar
To clarify: my question is not about "who could I exclude NAs from being counted" - I know how to do that. My question is: Why na.rm = T is not working for geom_bar in this case? On Thu, Jul 27, 2017 at 8:24 AM, Dimitri Liakhovitski < dimitri.liakhovitski at gmail.com> wrote: > Hello! > > I am trying to understand how ggplot2's geom_bar treats NAs. > The help file
2007 Aug 08
1
Help using gPath
Hi everyone,I'm trying to figure out how to use gPath and the documentation is not very helpful :( I have the following plot object: plot-surrounds:: background plot.gTree.378:: background guide.gTree.355:: (background.rect.345, minor-horizontal.segments.347, minor-vertical.segments.349, major-horizontal.segments.351, major-vertical.segments.353) guide.gTree.356::
2017 Jul 27
3
na.rm = T treatment by ggplot2's geom_bar
Hello! I am trying to understand how ggplot2's geom_bar treats NAs. The help file says: library(ggplot2) ?geom_bar na.rm: If FALSE, the default, missing values are removed with a warning. If TRUE, missing values are silently removed. I am trying it out: md <- data.frame(a = c(letters[1:5], letters[1:4], letters[1:3], rep(NA, 3))) str(md); levels(md$a) ggplot(data = md, mapping = aes(x =
2017 Jul 27
1
na.rm = T treatment by ggplot2's geom_bar
I suspect this is by design. Questions about "why" should probably cc the contributed package maintainer(s). -- Sent from my phone. Please excuse my brevity. On July 27, 2017 7:49:47 AM PDT, Dimitri Liakhovitski <dimitri.liakhovitski at gmail.com> wrote: >To clarify: my question is not about "who could I exclude NAs from >being >counted" - I know how to do
2017 Jul 27
2
na.rm = T treatment by ggplot2's geom_bar
Just a thought: Did you try na.rm = TRUE in case you have an object named "T" in scope? -- Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Thu, Jul 27, 2017 at 7:49 AM, Dimitri Liakhovitski <dimitri.liakhovitski at
2017 Jul 27
0
na.rm = T treatment by ggplot2's geom_bar
Thank you, Bert! I do NOT have an object named "T" in scope (I checked - and besides, it would never occur to me to use this name). TRUE or T results in the same unexpected behavior: ggplot(data = md, mapping = aes(x = a)) + geom_bar(na.rm = TRUE) On Thu, Jul 27, 2017 at 10:57 AM, Bert Gunter <bgunter.4567 at gmail.com> wrote: > Just a thought: > > Did you try
2017 Jul 27
2
na.rm = T treatment by ggplot2's geom_bar
I think you should be more suspicious of yourself, Dimitri. A letter T variable can easily arise in the problem domain when you are not thinking of logical values at all, at which point your cavalier use of T as a synonym for TRUE can suddenly become a bug. -- Sent from my phone. Please excuse my brevity. On July 27, 2017 8:18:03 AM PDT, Dimitri Liakhovitski <dimitri.liakhovitski at
2017 Jul 27
0
na.rm = T treatment by ggplot2's geom_bar
?hanks for the advice, Jeff. Will keep it in mind. But I am anal - I shy away from using letters and words that "look familiar" to me in R (such as mean, sd, T, etc.) But still, it's a good advice. On Thu, Jul 27, 2017 at 11:53 AM, Jeff Newmiller <jdnewmil at dcn.davis.ca.us> wrote: > I think you should be more suspicious of yourself, Dimitri. A letter T > variable can
2013 Apr 30
1
Stacked geom_bar with aggregated SE -ggplot2
Hi there,? I've been battling with an extension of this in my own data: getting appropriate error bars once data is stacked in a bar graph.? (original question: http://r.789695.n4.nabble.com/ggplot2-se-variable-in-geom-errorbar-s-limits- td3311176.html). It wouldn't let me reply to that thread. A modification of the earlier answer:? data(diamonds)? ?diamonds_df <- ddply(diamonds,
2010 Mar 12
1
simple plot in ggplot2, wrong error bars
I was wondering if anyone could help me with this, simple problem. I am essentially following the example on Hadley's webpage (http://had.co.nz/ggplot2/geom_errorbar.html), but it still doesn't make any sense to me. df <- data.frame(trt = factor(c("intact", "intact", "removed", "removed")), coon = c(0.093, 0.06, 0.057, 0.09), group =
2012 Feb 01
1
ggplot2(0.9.0): could not find function "=="
Hi, I have a question related to the newest version of ggplot2 (0.9.0). I just updated this morning and from CRAN it looks like the Mac version is the only one at 0.9.0 as of right now. http://cran.r-project.org/web/packages/ggplot2/index.html Anyway, I was in the midst of a project where I was trying to replicate "Back-to-back Bar Charts" in this blog post.
2017 Jun 27
0
ggplot2 geom_bar arrangement
You just have to change the levels of the factor ... library(ggplot2) Lab = c(letters[4:6], letters[1:3]) valuex = c(3.1,2.3,0.4,-0.4,-1.2,-4.4) df <- data.frame(Lab,valuex) # set the factor levels to the same order as observed in the data frame df$Lab <- factor(df$Lab, levels=unique(df$Lab)) px <- ggplot(df,aes(Lab,valuex,label=Lab)) + geom_text(aes(y=0)) + geom_bar(stat =
2017 Jun 27
4
ggplot2 geom_bar arrangement
Hi, I was trying to draw a geom_bar plot. However, by default, the bars are arranged according to the label, which I don't want. I want the bars to appear exactly as they appear in the data frame. For example in the code: Lab=c(letters[4:6],letters[1:3]) valuex = c(3.1,2.3,0.4,-0.4,-1.2,-4.4) df <- data.frame(Lab,valuex) px <- ggplot(df,aes(Lab,valuex,label=Lab)) +
2017 Aug 13
1
ggplot's aes_ doesn't work as expected for x=factor()
I'm learning how to use ggplot in a programming approach where I supply variable names on the fly. Using aes_ doesn't work as I expected when x = factor(x). Is this a bug or am I not understanding something? # toy dataset df <- data.frame(LogicalVar = c(FALSE, TRUE, FALSE, TRUE, FALSE, TRUE), Var1 = c(0.01, 0.01, 1, 1, 30, 30), pct1 = c(12, 88, 60,
2012 Aug 10
1
ggplot2 geom_bar produces white slashes in legend keys
When I am using geom_bar I get these white slashes through the legend keys. I cannot figure out how to remove them. ggplot(diamonds, aes(clarity, fill=cut)) + geom_bar() I have tried using opts(legend.key = theme_blank()) but with no luck. Any suggestions would be much appreciated. I am using R vers. 2.15.0 and ggplot 0.9.1, win xp Best wishes Jonas Hal
2010 Aug 04
2
ggplot2 barplot: extra markers in graph
Dear List, (self-contained example + version info at the bottom) I'm having trouble producing a barplot using the functions in ggplot2. When I use the position="dodge" option, the bars are plotted but also a number of spurious markers. More specifically, a number of black dots are plotted in the graph that should not be there. This behaviour is not seen when calling the same
2018 Jan 15
0
barplot that displays sums of values of 2 y colums grouped by different variables
It is not generally advisable to get too fancy with stat functions in ggplot... things can easily get more complicated than ggplot is ready to handle when it comes to calculations. It is better to create data that corresponds directly to the graphical representations you are mapping them to. Read [1] for more on this philosophy. [1] H. Wickham, Tidy Data, Journal of Statistical Software,
2012 Dec 21
2
ggplot2: setting martin
Is it possible to set the margin in ggplot2 to a fixed size? I create many plots, and I want them to look the same. Especially I want them to have the same left margin. But P<-ggplot()+geom_bar(aes(c("short label1","short label2"),runif(2)))+coord_flip() P<-creates a plot with another margin as ggplot()+geom_bar(aes(c("very very very very long
2012 Feb 01
3
Plotting bar graph over a geographical map
Hi, I am looking for a way to plot bar on a map instead of the standard points. I have been using ggplot2 and maps libraries. The points are added with the function geom_point. I know that there is a function geom_bar but I can't figure out how to use it. Thank you for your help, Simon ### R-code library(ggplot2) library(maps) measurements <-