Re: [R] Barplot for data frame

2023-11-29 Thread Ben Tupper
Another great resource is RSeek.org https://rseek.org/?q=barplot On Wed, Nov 29, 2023 at 4:26 AM Ivan Krylov wrote: > В Wed, 29 Nov 2023 00:29:49 + > Livio Beqiri пишет: > > > how can i create a vertical barplot that displays brands in x-axis > > and Revenue in Y-axis > > What have you tri

Re: [R] Barplot for data frame

2023-11-29 Thread Ivan Krylov
В Wed, 29 Nov 2023 00:29:49 + Livio Beqiri пишет: > how can i create a vertical barplot that displays brands in x-axis > and Revenue in Y-axis What have you tried? If you're not currently studying R with an instructor (who should be contacted with basic questions like this instead; see the p

Re: [R] Barplot for data frame

2023-11-29 Thread Dr Eberhard Lisse
Look like homework to me :-)-O el On 2023-11-29 02:29 , Livio Beqiri wrote: I have a dataframe df <- df <- data.frame (Revenue = c("100", "300", "500"), Brand = c("Apple", "HP", "Lenovo") ) how can i create a vertical barplot that displays brands in x-ax

[R] Barplot for data frame

2023-11-29 Thread Livio Beqiri
I have a dataframe df <- df <- data.frame (Revenue = c("100", "300", "500"), Brand = c("Apple", "HP", "Lenovo") ) how can i create a vertical barplot that displays brands in x-axis and Revenue in Y-axis [[alternative HTML version deleted]] ___

Re: [R] barplot that displays sums of values of 2 y colums grouped by different variables

2018-01-16 Thread kenneth dyson
Thanks everyone. Got it to work like this, if anyone is interested: import the data with readr, taking in only the columns that have numeric values ("n" and "y") and the column with the groups ("city"). aggregate the data by the group ("city") so that each variable has a sum: |sum_data <-aggre

Re: [R] barplot that displays sums of values of 2 y colums grouped by different variables

2018-01-15 Thread Jeff Newmiller
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.

Re: [R] barplot that displays sums of values of 2 y colums grouped by different variables

2018-01-15 Thread Jim Lemon
Hi Kenneth, I don't know about ggplot, but perhaps this will help: kddf<-read.table(text="city n y mon 100 200 tor 209 300 edm 98 87 mon 20 76 tor 50 96 edm 62 27", header=TRUE,stringsAsFactors=FALSE) library(plotrix) barpos<-barp(t(kddf[,2:3]),names.arg=kddf[,1],xlab="City",ylab="Sum", main="Sum

Re: [R] barplot that displays sums of values of 2 y colums grouped by different variables

2018-01-15 Thread Eric Berger
https://stackoverflow.com/questions/25070547/ggplot-side-by-side-geom-bar On Mon, Jan 15, 2018 at 9:39 PM, Kenneth Dyson 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 oth

Re: [R] barplot that displays sums of values of 2 y colums grouped by different variables

2018-01-15 Thread Eric Berger
'position="dodge"' has no effect in the plot because the x-axis is a factor variable. The bars do not need to be moved to avoid each other. The 'aes(fill=y)' is specifying that you want the color gradient to capture the sums in the 'y' variable. You might be better off to use 'no' and 'yes' rather

[R] barplot that displays sums of values of 2 y colums grouped by different variables

2018-01-15 Thread kenneth dyson
I am trying to create a barplot displaying the sums of 2 columns of data grouped by a variable. the data is set up like this: "city" "n" "y" mon 100 200 tor 209 300 edm 98 87 mon 20 76 tor 50 96 edm 62 27 the resulting plot should have city as the x-axis, 2 bars per city, 1 representing

Re: [R] barplot beside=TRUE - values differ on scales

2016-10-12 Thread Jim Lemon
Hi Adrian, Perhaps what you want is this: ajdat<-structure(c(112L, 0L, 579L, 1L, 131L, 1L, 2234L, 2L, 2892L, 1L, 528L, 0L, 582L, 2L), .Dim = c(2L, 7L), .Dimnames = list(c("GN", "CN"), c("DC5", "DC8", "DC14", "DC18", "DC19", "DC20", "DC23" ))) library(plotrix) twoord.plot(0.8:6.8,ajdat[2,],1.2:7.2,

Re: [R] barplot beside=TRUE - values differ on scales

2016-10-12 Thread Adrian Johnson
gt;> David L Carlson >> Department of Anthropology >> Texas A&M University >> College Station, TX 77840-4352 >> >> >> >> -Original Message- >> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Adams, Jean >> Sent: Wedne

Re: [R] barplot beside=TRUE - values differ on scales

2016-10-12 Thread Adrian Johnson
David L Carlson > Department of Anthropology > Texas A&M University > College Station, TX 77840-4352 > > > > -Original Message- > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Adams, Jean > Sent: Wednesday, October 12, 2016 12:44 PM > To: Adrian Johnso

Re: [R] barplot beside=TRUE - values differ on scales

2016-10-12 Thread David L Carlson
p-boun...@r-project.org] On Behalf Of Adams, Jean Sent: Wednesday, October 12, 2016 12:44 PM To: Adrian Johnson Cc: r-help Subject: Re: [R] barplot beside=TRUE - values differ on scales Adrian, Very interesting. What do you think of using colors to indicate the five possible loss/gain levels? For example:

Re: [R] barplot beside=TRUE - values differ on scales

2016-10-12 Thread Adams, Jean
Adrian, Very interesting. What do you think of using colors to indicate the five possible loss/gain levels? For example: a <- structure(c(112L, 0L, 579L, 1L, 131L, 1L, 2234L, 2L, 2892L, 1L, 528L, 0L, 582L, 2L), .Dim = c(2L, 7L), .Dimnames = list(c("GN", "CN"), c("DC5", "DC8", "DC14", "DC18",

Re: [R] barplot beside=TRUE - values differ on scales

2016-10-12 Thread Duncan Murdoch
On 12/10/2016 12:59 PM, Adrian Johnson wrote: Thanks Duncan. I am sorry I cannot scale second row (d[2,]). I was looking for a way to plot d[2,] values next to d[1,] with a right side axis=4 on right side. -2,-1,0,1,2 That doesn't really make graphical sense, but you can use any transformati

Re: [R] barplot beside=TRUE - values differ on scales

2016-10-12 Thread Adrian Johnson
Thanks Duncan. I am sorry I cannot scale second row (d[2,]). I was looking for a way to plot d[2,] values next to d[1,] with a right side axis=4 on right side. -2,-1,0,1,2 thanks Adrian On Wed, Oct 12, 2016 at 12:42 PM, Duncan Murdoch wrote: > On 12/10/2016 12:20 PM, Adrian Johnson wrote: >> >>

Re: [R] barplot beside=TRUE - values differ on scales

2016-10-12 Thread Adrian Johnson
Hi Adams, The story I am trying to show visually relationship between GN and CN for every column. Each column represents a patient. In each patient, a particular chromosome region (CN) is either lost (-2 or -1) or gained (1 or 2). Typically if loss (one copy loss - as humans have pair of chromosome

Re: [R] barplot beside=TRUE - values differ on scales

2016-10-12 Thread Duncan Murdoch
On 12/10/2016 12:20 PM, Adrian Johnson wrote: Dear group, I have been struggling to barplot two different measurements from one subject. These two measures differ in range. I want to plot row 1 axis on left side and row 2 values on right side. For a given column I want to plot GN and CN next to

Re: [R] barplot beside=TRUE - values differ on scales

2016-10-12 Thread Adams, Jean
Adrian, What story are you trying to tell? Or what question are you trying to answer by visualizing these data? How is a bar plot of these numbers going to help? I'm just wondering if perhaps a different visualization might make more sense, for example, a scatter plot of GN vs. CN. m <- struct

Re: [R] barplot beside=TRUE - values differ on scales

2016-10-12 Thread S Ellison
> -Original Message- > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Adrian > Johnson > Sent: 12 October 2016 17:21 > To: r-help > Subject: [R] barplot beside=TRUE - values differ on scales > > Dear group, > I have been struggling to barplot two

[R] barplot beside=TRUE - values differ on scales

2016-10-12 Thread Adrian Johnson
Dear group, I have been struggling to barplot two different measurements from one subject. These two measures differ in range. I want to plot row 1 axis on left side and row 2 values on right side. For a given column I want to plot GN and CN next to each other. my dput code is below : structure

Re: [R] barplot colour problem

2016-07-18 Thread Abdoulaye Sarr
Thank you Marc, The typo was causing the problem, solved now. Regards, Fipou On Mon, Jul 18, 2016 at 8:38 PM, Marc Schwartz wrote: > > > On Jul 18, 2016, at 1:06 PM, Abdoulaye Sarr > wrote: > > > > I am doing a basic bar plot which works but the color of bars positive > > (green) and negative

Re: [R] barplot colour problem

2016-07-18 Thread Marc Schwartz
> On Jul 18, 2016, at 1:06 PM, Abdoulaye Sarr wrote: > > I am doing a basic bar plot which works but the color of bars positive > (green) and negative (brown) don’t show up from the below command: > > barplot(z, ylim=c(-2,2), col=ifelse(x>0,"brown","green »)) > > any help? or other methods? >

[R] barplot colour problem

2016-07-18 Thread Abdoulaye Sarr
I am doing a basic bar plot which works but the color of bars positive (green) and negative (brown) don’t show up from the below command: barplot(z, ylim=c(-2,2), col=ifelse(x>0,"brown","green »)) any help? or other methods? fipou [[alternative HTML version deleted]] __

Re: [R] Barplot - Beginners Question

2015-10-04 Thread Boris Steipe
On Oct 4, 2015, at 7:39 PM, Duncan Murdoch wrote: > You'll get what you want if you use as.matrix(datentabelle)[,1] > instead of datentabelle[,1]. This happens to work in this particular case, but fails if the data frame contains text columns. Example: datentabelle <- cbind(datentabelle, tex

Re: [R] Barplot - Beginners Question

2015-10-04 Thread Duncan Murdoch
-BEGIN PGP SIGNED MESSAGE- Hash: SHA512 On 04/10/2015 3:31 PM, Jutta Wrage wrote: > Hi! > > According to this I tried to create a barplot: > > https://de.wikibooks.org/wiki/GNU_R:_barplot > > Input Data (Tab delimeted) > > Range Anzahl Prozent 36-40 12 1.92 41-45 21 3.

[R] Barplot - Beginners Question

2015-10-04 Thread Jutta Wrage
Hi! According to this I tried to create a barplot: https://de.wikibooks.org/wiki/GNU_R:_barplot Input Data (Tab delimeted) Range Anzahl Prozent 36-40 12 1.92 41-45 21 3.36 46-50 48 7.68 51-55 87 13.92 56-60 92 14.72 61-65 131 20.96 66-70 67 10.

Re: [R] barplot -issues with axis and labels not appearing

2015-07-22 Thread Jim Lemon
Hi Pierre, I get a reasonable plot using the following code: par(mar=c(6,4,4,2)) barpos<-barplot(unlist(GEP.data2), main="Global Portfolio Weights", col.main="gray", col=blues9, cex.axis=1, ylim=c(-1,1), las=2, cex.lab=1, cex=0.8) axis(1,at=barpos,labels=rep("",8)) For one thing, you don't ne

[R] barplot -issues with axis and labels not appearing

2015-07-21 Thread Pierre Micallef
Hi I am experiencing a few issues with the barplot function. I have written the following code; barplot(as.matrix(GEP.data2), beside=TRUE, main="Global Portfolio Weights", col.main="gray", col=blues9, cex.axis=0.1, ylim=c(-1,1), las=2, cex.lab=1, cex=0.8) where; > GEP.data2

Re: [R] Barplot

2015-02-24 Thread PIKAL Petr
gt; Sinha > Sent: Wednesday, February 25, 2015 8:33 AM > To: r-help > Subject: [R] Barplot > > i want to plot the following data in barplot > > Year Gender revenue > 2001 M 100 > 2001 F 150 > 2002 M75 > 2002 F200 > 2003 M150 > 200

[R] Barplot

2015-02-24 Thread Partha Sinha
i want to plot the following data in barplot Year Gender revenue 2001 M 100 2001 F 150 2002 M75 2002 F200 2003 M150 2003 F 75 I want to compare performance of gender in year wise fashion . How to do ? Parth

Re: [R] barplot: segment-wise shading

2014-01-17 Thread Marc Schwartz
On Jan 16, 2014, at 9:09 PM, Martin Weiser wrote: > Jim Lemon píše v Pá 17. 01. 2014 v 13:21 +1100: >> On 01/17/2014 10:59 AM, Marc Schwartz wrote: >>> >>> ... >>> Arggh. >>> >>> No, this is my error for not actually looking at the plot and presuming >>> that it would work. >>> >>> Turns out

Re: [R] barplot: segment-wise shading

2014-01-16 Thread Martin Weiser
Jim Lemon píše v Pá 17. 01. 2014 v 13:21 +1100: > On 01/17/2014 10:59 AM, Marc Schwartz wrote: > > > > ... > > Arggh. > > > > No, this is my error for not actually looking at the plot and presuming > > that it would work. > > > > Turns out that it does work for a non-stacked barplot: > > > >ba

Re: [R] barplot: segment-wise shading

2014-01-16 Thread Jim Lemon
On 01/17/2014 10:59 AM, Marc Schwartz wrote: ... Arggh. No, this is my error for not actually looking at the plot and presuming that it would work. Turns out that it does work for a non-stacked barplot: barplot(VADeaths, angle = 1:20 * 10, density = 10, beside = TRUE) However, internally

Re: [R] barplot: segment-wise shading

2014-01-16 Thread Marc Schwartz
On Jan 16, 2014, at 5:03 PM, Martin Weiser wrote: > Marc Schwartz píše v Čt 16. 01. 2014 v 16:46 -0600: >> On Jan 16, 2014, at 12:45 PM, Martin Weiser wrote: >> >>> Dear listers, >>> >>> I would like to make stacked barplot, and to be able to define shading >>> (density or angle) segment-wise

Re: [R] barplot: segment-wise shading

2014-01-16 Thread Martin Weiser
Marc Schwartz píše v Čt 16. 01. 2014 v 16:46 -0600: > On Jan 16, 2014, at 12:45 PM, Martin Weiser wrote: > > > Dear listers, > > > > I would like to make stacked barplot, and to be able to define shading > > (density or angle) segment-wise, i.e. NOT like here: > > # Bar shading example > > b

Re: [R] barplot: segment-wise shading

2014-01-16 Thread Marc Schwartz
On Jan 16, 2014, at 12:45 PM, Martin Weiser wrote: > Dear listers, > > I would like to make stacked barplot, and to be able to define shading > (density or angle) segment-wise, i.e. NOT like here: > # Bar shading example > barplot(VADeaths, angle = 15+10*1:5, density = 20, col = "black", >

[R] barplot: segment-wise shading

2014-01-16 Thread Martin Weiser
Dear listers, I would like to make stacked barplot, and to be able to define shading (density or angle) segment-wise, i.e. NOT like here: # Bar shading example barplot(VADeaths, angle = 15+10*1:5, density = 20, col = "black", legend = rownames(VADeaths)) The example has 5 diffe

Re: [R] Barplot not showing all labels

2014-01-15 Thread Jeff Johnson
is, what you see is not > what you think you have. You only have one variable in the data.frame and > that is the country names. > > For some reason the numbers are being considered as row names not as a > variable. Do a str(filename) to see what is happening. You do need to >

Re: [R] Barplot not showing all labels

2014-01-15 Thread Jeff Johnson
quot;, "BH", "BM", "BN", "BO", "BR", "BS", >> "CA", "CH", "CM", "CN", "CO", "CR", "CY", "DE", "DK", "DO", "EC", >> "ES&

Re: [R] Barplot not showing all labels

2014-01-15 Thread John Kane
ld you aggregate before graphing? John Kane Kingston ON Canada -Original Message- From: mrjeffto...@gmail.com Sent: Wed, 15 Jan 2014 09:20:11 -0800 To: jrkrid...@inbox.com Subject: Re: [R] Barplot not showing all labels Sorry guys, I'm running into an issue. I have a data frame. H

Re: [R] Barplot not showing all labels

2014-01-14 Thread Jeff Johnson
"TT", "TW", "TZ", "US", > "ZA"), class = "factor"), val = c(0, 3, 0, 2, 1, 31, 4, 1, 1, > 1, 45, 1, 1, 4, 5, 86, 3, 1, 8, 1, 2, 1, 8, 2, 1, 2, 4, 2, 4, > 35, 3, 3, 14, 3, 5, 2, 5, 1, 2, 1, 15, 1, 11, 2, 2, 1, 1, 23, > 7, 1, 6,

Re: [R] Barplot not showing all labels

2014-01-14 Thread John Kane
U", "SA", "SE", "SG", "TC", "TH", "TT", "TW", "TZ", "US", "ZA"), class = "factor"), val = c(0, 3, 0, 2, 1, 31, 4, 1, 1, 1, 45, 1, 1, 4, 5, 86, 3, 1, 8, 1, 2, 1, 8, 2, 1, 2, 4, 2, 4, 35,

Re: [R] Barplot not showing all labels

2014-01-13 Thread William Dunlap
n...@r-project.org] On > Behalf > Of Jim Lemon > Sent: Monday, January 13, 2014 1:43 PM > To: Jeff Johnson > Cc: r-help@r-project.org > Subject: Re: [R] Barplot not showing all labels > > On 01/14/2014 06:15 AM, Jeff Johnson wrote: > > I have a table that consist

Re: [R] Barplot not showing all labels

2014-01-13 Thread Jim Lemon
On 01/14/2014 06:15 AM, Jeff Johnson wrote: I have a table that consists of the following country codes and frequencies: AE AN AR AT AU BB BD BE BH BM BN BO BR BS CA CH CM CN CO CR CY DE DK DO EC ES 0 3 0 2 1 31 4 1 1 1 45 1 1 4 5 86 3 1 8 1 2 1 8 2 1 2 4 FI FR GB GR

[R] Barplot not showing all labels

2014-01-13 Thread Jeff Johnson
I have a table that consists of the following country codes and frequencies: AE AN AR AT AU BB BD BE BH BM BN BO BR BS CA CH CM CN CO CR CY DE DK DO EC ES 0 3 0 2 1 31 4 1 1 1 45 1 1 4 5 86 3 1 8 1 2 1 8 2 1 2 4 FI FR GB GR GU HK ID IE IL IN IO IT JM JP KH KR KY LU LV MO

Re: [R] barplot - easy for experienced, difficult for me

2013-10-01 Thread Jim Lemon
On 10/01/2013 07:32 PM, happyR wrote: hey lobachevsky - thanks! but: Error in barplot.default (matrix, col = c("yellow","purple"), beside = TRUE) : 'height' must be a vector or a matrix what to do? :) First, one must always avoid confusing the general case with a specific instance. If you

Re: [R] barplot - easy for experienced, difficult for me

2013-10-01 Thread happyR
hey lobachevsky - thanks! but: Error in barplot.default (matrix, col = c("yellow", "purple"), beside = TRUE) : 'height' must be a vector or a matrix what to do? :) Gesendet: Dienstag, 01. Oktober 2013 um 10:42 Uhr Von: "Jim Lemon [via R]"

Re: [R] barplot - easy for experienced, difficult for me

2013-10-01 Thread John Kane
ot;identity") + facet_grid(park ~ .) + theme(legend.position="none") John Kane Kingston ON Canada > -Original Message- > From: tobi_gebetsber...@gmx.at > Sent: Mon, 30 Sep 2013 06:05:09 -0700 (PDT) > To: r-help@r-project.org > Subject: [R] barplot - eas

Re: [R] barplot - easy for experienced, difficult for me

2013-10-01 Thread Jim Lemon
On 10/01/2013 05:53 PM, happyR wrote: ... Do you think it might have sth to do with how my dataset is built up? Yes, happyR, it is definitely your dataset. I think this one is far superior: spineless<-matrix(c(6,3,9,5,4,6,7,1,3,8,7,6,10,4,3,7,6,11), nrow=2) slnames<-c("Bug","Slug","Wasp","Ti

Re: [R] barplot - easy for experienced, difficult for me

2013-10-01 Thread happyR
Hi Jean,   I tried to follow the introductions on statmethods... Didn't really work.   Do you think it might have sth to do with how my dataset is built up?   Thanks for your help!   Tobias       Gesendet: Montag, 30. September 2013 um 23:27 Uhr Von: "Adams, Jean [via R]" <

Re: [R] barplot - easy for experienced, difficult for me

2013-09-30 Thread Adams, Jean
Look at the example for grouped bar plots here, http://www.statmethods.net/graphs/bar.html Jean On Mon, Sep 30, 2013 at 8:05 AM, happyR wrote: > hey guys, > > I wanna make a simple barplot, looking like this excel graph: >

[R] barplot - easy for experienced, difficult for me

2013-09-30 Thread happyR
hey guys, I wanna make a simple barplot, looking like this excel graph: my data set includes 9 groups of invertebrates (x-axes) and total number (y-axes) from two different parks (1 and 2). my data-set looks like that:

Re: [R] barplot to the right side

2013-09-30 Thread Jim Lemon
On 09/30/2013 07:47 PM, Juan Andres Hernandez wrote: Hi, does anybody know how to get a barplot with the x axis starting in the right side and the y axis in the right side too? An example: dat=c(2,4,0,6,5) names(dat)=paste('dpt.',1:5,sep='') barplot(dat, horiz=T) box() I need this barplot in mi

[R] barplot to the right side

2013-09-30 Thread Juan Andres Hernandez
Hi, does anybody know how to get a barplot with the x axis starting in the right side and the y axis in the right side too? An example: dat=c(2,4,0,6,5) names(dat)=paste('dpt.',1:5,sep='') barplot(dat, horiz=T) box() I need this barplot in mirror, with the zero value to 6 starting in the right si

Re: [R] barplot: add an image in each bar

2013-08-14 Thread Jim Lemon
On 08/15/2013 01:16 AM, Igor Ribeiro wrote: Dear all, I need to insert an small icon in each bar of a barplot, in a specific location (depending on bar's value). For example: the first bar has X value of 5. I need to insert an icon at X value 3. The second bar has X value of 8. I need to insert a

[R] barplot: add an image in each bar

2013-08-14 Thread Igor Ribeiro
Dear all, I need to insert an small icon in each bar of a barplot, in a specific location (depending on bar's value). For example: the first bar has X value of 5. I need to insert an icon at X value 3. The second bar has X value of 8. I need to insert an icon at value 7. I have both vectors with va

Re: [R] barplot colors

2013-03-26 Thread Francois De Ryckel
Hi Rui, Thanks for trying. I know about the beside. The reason I want them stack with various colors is that the 4 stacks represent the number of students on each quartiles on a test. Have a terrific Tuesday! François On 26 Mar 2013, at 21:45, Rui Barradas wrote: > Hello, > > I forgot to

Re: [R] barplot colors

2013-03-26 Thread Francois De Ryckel
Hi David, Thanks a lot for your advice and helping me tricking barplot. It totally work. Have a great evening! François On 26 Mar 2013, at 21:43, David L Carlson wrote: > You will have to trick barplot into thinking you have four groups: > >> wmod <- cbind(c(w[,1], 0, 0), c(0, 0, w[,2])) >> b

Re: [R] barplot colors

2013-03-26 Thread Rui Barradas
Hello, I forgot to add that if you use argument beside = TRUE, you can have as many colors as there are bars, but this is not the kind of graph you want. (This behavior makes a lot of sense if you look at the underlying code for barplot.) Rui Barradas Em 26-03-2013 19:39, Rui Barradas escre

Re: [R] barplot colors

2013-03-26 Thread David L Carlson
vid L Carlson Associate Professor of Anthropology Texas A&M University College Station, TX 77843-4352 > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of Francois de Ryckel > Sent: Tuesday, March 26, 2013 1:09 PM >

Re: [R] barplot colors

2013-03-26 Thread Rui Barradas
Hello, According to the code in file src/R/graphics/barplot.R, barplot() will draw column by column, and threfore use as many colors as rows in the matrix. Those colors will be reused for all bars. So I'm not seeing an easy way of doing what you want using base graphics. Not without changing

[R] barplot colors

2013-03-26 Thread Francois de Ryckel
Dear all, I have a 2 by 2 matrix and I would like to do a barplot with it. (so 2 bars with each having 2 stacks.). I would like to have one colors per stack, so 4 different colors total. The problem is that R is only given me 2 colors (the same two for the bottom stack and the same two for th

Re: [R] Barplot with lines

2012-11-25 Thread Ripples
Hi Jim, I did the same and it worked. Thanks a lot! SK On Fri, Nov 23, 2012 at 6:11 PM, Jim Lemon wrote: > On 11/24/2012 02:21 AM, skanap wrote: > >> >> Hi Jim, >> >> Thank you for the reply. But, when I use Barpos I get this error. >> >> plot(mydata$score,barpos) >> Error in xy.coords(x, y, x

Re: [R] Barplot with lines

2012-11-23 Thread Jim Lemon
On 11/24/2012 02:21 AM, skanap wrote: Hi Jim, Thank you for the reply. But, when I use Barpos I get this error. plot(mydata$score,barpos) Error in xy.coords(x, y, xlabel, ylabel, log) : 'x' and 'y' lengths differ I need all the points in x-axis that are in 'days' column. If I'm selecting o

Re: [R] Barplot with lines

2012-11-23 Thread skanap
Hi Jim, Thank you for the reply. But, when I use Barpos I get this error. plot(mydata$score,barpos) Error in xy.coords(x, y, xlabel, ylabel, log) : 'x' and 'y' lengths differ I need all the points in x-axis that are in 'days' column. If I'm selecting only points in val1 and val2 I'm missing

Re: [R] Barplot with lines

2012-11-23 Thread Greg Snow
Look at the updateusr function in the TeachingDemos package. One of the examples shows adding lines to a barplot. On Fri, Nov 23, 2012 at 12:33 AM, Ripples <9ripp...@gmail.com> wrote: > Hi, > > I'm trying to plot stacked barplot with lines on it. Here is the data. > > emp days val1 val2 score

Re: [R] Barplot with lines

2012-11-23 Thread Jim Lemon
On 11/23/2012 06:33 PM, Ripples wrote: Hi, I'm trying to plot stacked barplot with lines on it. Here is the data. emp days val1 val2 score 1 21 1 0 1200 2 35 1 1 na 3 42 na na 3000 4 53 2 1 2100 5 64 1 0 na 6 73 na na 1400 My X-axis is days. I'm looking to plot val1,val2 as stacked bars and s

[R] Barplot with lines

2012-11-22 Thread Ripples
Hi, I'm trying to plot stacked barplot with lines on it. Here is the data. emp days val1 val2 score 1 21 1 0 1200 2 35 1 1 na 3 42 na na 3000 4 53 2 1 2100 5 64 1 0 na 6 73 na na 1400 My X-axis is days. I'm looking to plot val1,val2 as stacked bars and score as lines with different y-axis. I co

Re: [R] barplot

2012-10-24 Thread Jim Lemon
On 10/24/2012 03:21 AM, Thiho Jules wrote: Hi, I want to make a barplot with the following datasets: I have a file as following: name chr position A1 A2 pop1 pop1 pop2 pop2 I have calculated a measure using all the values in columns "pops", the values are saved in a vector. Now I want to ma

Re: [R] barplot

2012-10-23 Thread arun
ules To: r-help@r-project.org Cc: Sent: Tuesday, October 23, 2012 12:21 PM Subject: [R] barplot Hi, I want to make a barplot with the following datasets: I have a file as following: name  chr position A1 A2 pop1 pop1 pop2 pop2 I have calculated a measure using all the values in columns "

[R] barplot

2012-10-23 Thread Thiho Jules
Hi, I want to make a barplot with the following datasets: I have a file as following: name chr position A1 A2 pop1 pop1 pop2 pop2 I have calculated a measure using all the values in columns "pops", the values are saved in a vector. Now I want to make a barplot using the values in this vector

Re: [R] barplot with some 0 frequencies

2012-10-05 Thread Guillaume2883
Thank for all your answer ! Here is another way I discoverd this morning : barplot(table(factor(variable, levels = 1:4)),names=c(1,2,3,4)) -- View this message in context: http://r.789695.n4.nabble.com/barplot-with-some-0-frequencies-tp4645102p4645208.html Sent from the R help mailing list arc

Re: [R] barplot with some 0 frequencies

2012-10-05 Thread Greg Snow
Others have shown barchart commands that include 0's. My guess (which could be wrong, feel free to ignore this e-mail if so) is that your problem is due to the way you are creating/summarizing the data before the plotting command is used. R needs some way to know about what bars you want, even if

Re: [R] barplot with some 0 frequencies

2012-10-05 Thread David Winsemius
On Oct 4, 2012, at 9:05 PM, David Winsemius wrote: > > On Oct 4, 2012, at 4:49 PM, Guillaume2883 wrote: > >> Hi all, >> >> I am back with a new question ! >> I recorded the occurence of 4 differents event on 20 places for a given time >> period. >> Now, I want to do some barplot of the frequen

Re: [R] barplot with some 0 frequencies

2012-10-04 Thread Richard M. Heiberger
barchart(-3:3 ~ letters[1:7], origin=0) On Fri, Oct 5, 2012 at 12:05 AM, David Winsemius wrote: > > On Oct 4, 2012, at 4:49 PM, Guillaume2883 wrote: > > > Hi all, > > > > I am back with a new question ! > > I recorded the occurence of 4 differents event on 20 places for a given > time > > period

Re: [R] barplot with some 0 frequencies

2012-10-04 Thread David Winsemius
On Oct 4, 2012, at 4:49 PM, Guillaume2883 wrote: > Hi all, > > I am back with a new question ! > I recorded the occurence of 4 differents event on 20 places for a given time > period. > Now, I want to do some barplot of the frequency of theses events for each > place, so it should be easy. My pr

[R] barplot with some 0 frequencies

2012-10-04 Thread Guillaume2883
Hi all, I am back with a new question ! I recorded the occurence of 4 differents event on 20 places for a given time period. Now, I want to do some barplot of the frequency of theses events for each place, so it should be easy. My problem is that I want to see the frequencies of the 4 events on my

Re: [R] Barplot with Secondary axis

2012-08-22 Thread vikrant
Thanks Rui and Greg for providing me the solution , it Works. -- View this message in context: http://r.789695.n4.nabble.com/Barplot-with-Secondary-axis-tp4640980p4641081.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-pr

Re: [R] Barplot with Secondary axis

2012-08-22 Thread Greg Snow
Using par(new=TRUE) will often cause more problems than it helps. A better approach would be to use the twoord.plot function from the plotrix package or to use the updateusr function from the TeachingDemos package along with the lines function to add the lines afterwards. On Wed, Aug 22, 2012 at

Re: [R] Barplot with Secondary axis

2012-08-22 Thread Rui Barradas
Hello, You were almost there. x = c("a","b","c","d") y= cbind(c(50,40,30,20),c(40,30,20,10)) y2 = c(0.80,0.65,0.75,0.50) # bp <- barplot(t(y), beside = TRUE) xlim <- c(floor(min(bp)), ceiling(max(bp))) # par(new=T) plot(colMeans(bp), y2, type="o", col="black", lwd=3, lty=1, xaxt="n", yaxt="n

[R] Barplot with Secondary axis

2012-08-22 Thread vikrant
Hi all, I am trying to plot a bar chart and trying to plot a line as a secondary axis as my scale is different for two y axis. I am plotting a clustered bar chart by using besides = True option in barplot function and my y coordinates are not plotted exactly at the center on each two bars. Pleas

Re: [R] barplot question

2012-07-31 Thread Rui Barradas
Hello, Ok, final retouches. 1. Divide the par() call: oldpar <- par(mar=c(9, 4.1, 4.1, 2.1)) oldfont <- par(font=3) Then, just before legend() par(oldfont) # back to normal font 2. Modify the text() call to text(as.vector(bp), y = -6.5, cex=0.7, pos = 2, offset = -0.25, ...etc

Re: [R] barplot question

2012-07-30 Thread Rui Barradas
Hello, Try the following. plants_herbs_input_top10 <- structure(list(total = c(28L, 17L, 11L, 6L, 6L, 5L, 4L, 3L, 3L, 2L), young = c(29L, 22L, 15L, 8L, 5L, 3L, 2L, 2L, 2L, 2L), old = c(36L, 11L, 11L, 8L, 6L, 5L, 4L, 3L, 2L, 2L)), .Names = c("total", "young", "old"), class = "data.frame", row.

[R] barplot question

2012-07-30 Thread Michael Eisenring
Dear r-help members. I would like to: a) control the margin around my legend box. Unfortunately I did not find an appropriate command under "?legend". The margin around the actual legend is way too wide. There is a lot of unnecessary "empty space" on the right side. b) increase the width of t

Re: [R] barplot problem

2012-05-27 Thread jack hietpas
Richard- thank you very very much, this is exactly what I needed. I have not previously used lattice graphics, I will have to experiment more with this package. Also thanks to everyone for your input. -jh On Sun, May 27, 2012 at 1:04 PM, Richard M. Heiberger wrote: > I would use barchart in la

Re: [R] barplot problem

2012-05-27 Thread Richard M. Heiberger
I would use barchart in lattice. To get control of spacing you need to use the panel.barchart with the xyplot function. I show two options below. The first labels the distance scale with the default values seq(0,300,50), The second labels the bars with their distance value. tmp <- data.frame(y

Re: [R] barplot problem

2012-05-27 Thread Uwe Ligges
On 27.05.2012 17:46, jack hietpas wrote: Hi Jim- Thanks for your help. I am not sure how to execute your instructions... I used the space argument to to equally space the bars (barplot(data, space=c(1,1,1,1,1,1)). How do I get the "x positions in the return values". Take care, xp <- barpl

Re: [R] barplot problem

2012-05-27 Thread jack hietpas
Hi Jim- Thanks for your help. I am not sure how to execute your instructions... I used the space argument to to equally space the bars (barplot(data, space=c(1,1,1,1,1,1)). How do I get the "x positions in the return values". Take care, -jh On Sun, May 27, 2012 at 3:42 AM, Jim Lemon wrote:

Re: [R] barplot problem

2012-05-27 Thread Jim Lemon
On 05/27/2012 01:26 PM, jack hietpas wrote: Hello- I am having trouble making a barplot... The y-values are: data=c(-0.0002129061,0.00,-0.0002699561,0.0163883061,0.04). The x-values are distance=c(0, 71, 172, 206, 292). The desired x-range is 0 and ~300+ (kilometers), range=seq(

Re: [R] barplot problem

2012-05-26 Thread R. Michael Weylandt
It sounds like you want something of the form plot(distance, data, type = "h") But the lines might be too thin: try adding lwd = NUM to increase the thickness. Hope this helps, Michael On Sat, May 26, 2012 at 11:26 PM, jack hietpas wrote: > Hello- I am having trouble making a barplot... > > Th

[R] barplot problem

2012-05-26 Thread jack hietpas
Hello- I am having trouble making a barplot... The y-values are: data=c(-0.0002129061,0.00,-0.0002699561,0.0163883061,0.04). The x-values are distance=c(0, 71, 172, 206, 292). The desired x-range is 0 and ~300+ (kilometers), range=seq(0,300,1) I would like to make a bar plot with

Re: [R] barplot

2012-05-23 Thread Rui Barradas
Hello, Would the following do it? # make the dates vector x <- seq(as.Date("2011-03-15"), as.Date("2011-09-09"), by="day") # this is the important part labs <- seq(min(x), max(x), by="month") # "month", not 30 labs <- format(labs, "%b") labs.pos <- round(seq(1, length(x), length.out=length(labs

Re: [R] barplot

2012-05-23 Thread bets
Thank you for the answer. I tried the first suggestion, but that didn't work (length didn't match again), unless I'm doing something wrong. The stacklab function is nice, but still I'm having way to much labels. Maybe the actual graph makes it more clear: http://r.789695.n4.nabble.com/file/n46310

Re: [R] barplot

2012-05-23 Thread Jim Lemon
On 05/23/2012 09:34 PM, bets wrote: Hey, I am trying to create barplot of abundances over time (in days). The period is over 171 days, so I don't want to have all labels there but only the first day of the month. I couldn't find anything like this on the forum yet. Mostrly it's about year to yea

[R] barplot

2012-05-23 Thread bets
Hey, I am trying to create barplot of abundances over time (in days). The period is over 171 days, so I don't want to have all labels there but only the first day of the month. I couldn't find anything like this on the forum yet. Mostrly it's about year to year data. This is the relevant part of

Re: [R] barplot: legend: two rows

2012-05-22 Thread Marion Wenty
Hello Uwe, thanks for drawing this to my attention! I tried it again without adding another empty legend element and it worked - yes, the second row not being visible was my problem. Now it works! Thanks again, Marion 2012/5/15 Uwe Ligges > > > On 15.05.2012 17:38, Marion Wenty wrote: > >> Hel

Re: [R] barplot: legend: two rows

2012-05-15 Thread Uwe Ligges
On 15.05.2012 17:38, Marion Wenty wrote: Hello, I solved my problem with the uneven numbers of legend elements, which should be put into more than one rows, in the following way: I added another legend element which is empty ("") and is filled with "white": legend(0,-1.4,xjust=0,ncol=3,legen

Re: [R] barplot: legend: two rows

2012-05-15 Thread Marion Wenty
Hello, I solved my problem with the uneven numbers of legend elements, which should be put into more than one rows, in the following way: I added another legend element which is empty ("") and is filled with "white": legend(0,-1.4,xjust=0,ncol=3,legend=c(colnames(dat)[-1],""),fill=c("navyblue","

  1   2   3   4   >