similar to: barplot that displays sums of values of 2 y colums grouped by different variables

Displaying 20 results from an estimated 6000 matches similar to: "barplot that displays sums of values of 2 y colums grouped by different variables"

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,
2018 Jan 15
0
barplot that displays sums of values of 2 y colums grouped by different variables
https://stackoverflow.com/questions/25070547/ggplot-side-by-side-geom-bar On Mon, Jan 15, 2018 at 9:39 PM, Kenneth Dyson <kenneth at kidscodejeunesse.org > wrote: > Hi Eric, > > Thanks for the detailed response. > This is not exactly what I want to do but is close. > I want 2 bars for each city, 1 with the sum for "yes" , the other, beside > it, with the sum for
2013 Feb 03
1
ggplot2 plotting errorbars.
Hi, i'm using this lines of code: dodge <-position_dodge(width=0.9) ggplot(dfm,aes(x = X,y = value)) + geom_bar(aes(fill = variable), position=dodge, stat="identity") + geom_errorbar(aes(ymin=value-er, ymax=value+er),width=0.25, position=dodge,stat="identity") to plot this data frame X variable value er 1 A X4 58.74 9.44 2 B X4
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 =
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
2007 Oct 14
1
ggplot2: ordering categorial data
Hello again, everytime I think I got something to work, the next issue comes up... I have the following data.frame, I want to visualize: > data_rb tld spam1 spam2 share 1 ca 826436 73452 0.0889 2 org 470550 25740 0.0547 3 de 156042 15531 0.0995 4 com 140753 7527 0.0535 5 edu 34845 2507 0.0719 6 net 12781 382 0.0299 7 ru 7648 18 0.0024
2010 Sep 01
2
ggplot2 multiple group barchart
hi there.. i got a problem with ggplot2. here my example: library (ggplot2) v1 <- c(1,2,3,3,4) v2 <- c(4,3,1,1,9) v3 <- c(3,5,7,2,9) gender <- c("m","f","m","f","f") d.data <- data.frame (v1, v2, v3, gender) d.data x <- names (d.data[1:3]) y <- mean (d.data[1:3]) pl <- ggplot (data=d.data, aes (x=x,y=y)) pl
2011 Nov 16
1
geom_bar with missing data in package ggplot
Dear all, I was hoping someone could help with a ggplot question. I would like to generate a faceted bar chart, but missing data are causing problems. g<-structure(list(Date = structure(c(11322, 11687, 12052, 11322, 11687, 12052, 11322, 11687, 12052, 11322, 11687, 12052), class = "Date"), variable = c("Govt Revenues to GDP", "Govt Revenues to GDP",
2020 Sep 27
2
GRÁFICO DE BARRAS COMPARATIVO VARIOS AÑOS
Buenas noches, Tengo que preparar un gráfico de barras comparativo para varios años, en el que tenga agrupadas, 3 barras para enero, 3 barras para febrero, 3 barras para marzo y así sucesivamente para todos los meses, estando en cada mes, los años 2020, 2019 y 2018 (juntas), un pequeño espacio y luego las de febrero y así sucesivamente... Con el siguiente código, hago un año:
2010 Nov 23
2
Help with grouped barplot
Given the data structure below, how can I create a bar plot for the values of disc for each area grouped by year? bar <-structure(list(year = c(2003, 2003, 2003, 2003, 2003, 2003, 2003, 2007, 2007, 2007, 2007, 2007, 2007, 2007), area = structure(c(6L, 4L, 1L, 2L, 3L, 5L, 7L, 6L, 4L, 1L, 2L, 3L, 5L, 7L), .Label = c("AK", "ID", "MT", "NW",
2013 Oct 30
1
ggplot2 - how to get rid of bar boarder lines
Hello! I am using ggplot2: ggplot(myplotdata, aes(x=att_levels, y=WTP)) + geom_bar(stat="identity",fill="dark orange",colour="black", alpha = 1,position = "identity") + geom_text(aes(label=WTP),colour="black",size=4,hjust=1.1,position='dodge') + coord_flip() + xlab("") +
2012 Mar 12
1
ggplot2: coord_polar
Hello HelpeRs, The last print statement in the code segment below results in : Error in data$x[data$x == -Inf] <- range$x.range[1] : replacement has length zero R version 2.14.1 Patched (2011-12-23 r57982) ggplot2: version 0.90 OS : Linux (64bit) Any thoughts? Many Thanks, A. ## code segment starts here df <- data.frame( trt = factor(c(1, 1, 2, 2)), resp = c(1, 5,
2010 Sep 10
3
ggplot bar geom: control the filling in the colour legend
Hi all, Is it possible to change the filling of the squares used to represent the colour legend in a bar plot with ggplot? in this example, fillings are raven black, I'd like them white. ggplot(diamonds, aes(clarity, colour = cut)) + geom_bar() Regards -- ------------- Benoit Boulinguiez Ph.D student Ecole de Chimie de Rennes (ENSCR) Bureau 1.20 Equipe CIP UMR CNRS 6226 "Sciences
2008 Feb 06
1
Histogram/Bar plot graph
Hi, I have the following data: > Myvalues Gene ES MEF Embryo ESHyp 1 GeneA -0.38509507 0.00 1.6250 1.7039921 2 GeneB 0.06262914 0.00 1.6250 -0.272033 and so on... I want to plot the expression values of GeneA and GeneB in the different cell/embryo/conditions (columns 2:5 above). Now, if I do: >library(ggplot2) > qplot(x=Gene, Embryo, geom =
2013 Oct 30
1
ggplot2 question: keeping the order as in the input data
Hello! I am using ggplot2 (see the code below) to plot the data in 'myplotdata'. The first column of 'myplotdata' is called "att.levels" and contains strings; the second column is called "WTP" and contains numeric values. Notice - I use 'coord.flip()' The command aes(x=att_levels, y=WTP), if I understand correctly, sorts things alphabetically based on
2008 Jun 16
1
ggplot2: How to remove legend component for geom_errorbar() ?
Dear list (probably Hadley), I'm trying to do a plot like the following, composed of bars and error bars: df <- data.frame(factor1=gl(2,5), factor2=gl(5,1), y=rnorm(10), err=0.1) ggplot(df, aes(x=factor1, y=y, fill=factor2)) + geom_bar(position="dodge", stat="identity") + geom_errorbar(aes(min=y-err, max=y+err), position="dodge", width=0.1) The
2023 Feb 21
2
Problem of intercept?
Dear R-experts, Here below my R code working with quite a few warnings.? x11 and x12 are dichotomous variable (0=no and 1=yes). I substract 1 to ignore intercept. I would like not to ignore intercept. How to modify my R code because if I just remove -1 it does not work? y= c(32,45,65,34,23,43,65,76,87,98,7,867,56,45,65,76,88,34,55,66) x11=c(0,1,1,0,0,1,1,1,0,0,1,0,0,1,0,0,1,1,0,1)
2012 Mar 12
1
Faceted bar plot shows wrong counts (ggplot2)
I have encountered a problem with faceted bar plots. I have tried to create something like the example explained in the ggplot2 book (see pp. 126-128): library(ggplot2) mpg4 <- subset(mpg, manufacturer %in% c("audi", "volkswagen", "jeep")) mpg4$manufacturer <- as.character(mpg4$manufacturer) mpg4$model <- as.character(mpg4$model) base <-
2009 Feb 02
1
Specifying the gap between "dodge'd" bins groups?
I'm looking at ggplot-static\position_dodge.html   For ggplot(diamonds, aes(x=price, fill=cut)) + geom_bar(position="dodge") , is it possible to specify the spacing between the dodge'd bin groupings?    That is, I would like for there to be a small separation (horizontal space) between the "Ideal" and the "Fair" bars on the plot.  That way the reader can get
2012 Feb 19
2
barplot with more than 1 variable
Dear R listers, I am trying to produce a simple (for a stata user) barplot with 4 countries on the x axis, each country observed in 2 subsequent years and 3 variables. Basically, I should have three bars for each year for each country. I am attaching the chart I made in Stata, but I am not sure you'll manage to see it! I did the following: #here I create the data-set TUSE2. The vectors mw, st