Re: [R] R bar chart

2019-09-07 Thread Rui Barradas

Hello,

There is no attached file, R-help is doesn't allow many file types.
Try reposting with the extension .txt or post the output of


dput(head(dataset, 20))


directly in your e-mail.

Hope this helps,

Rui Barradas

Às 10:58 de 07/09/19, farshad goudarzian escreveu:

Hello.
Here I attach a microsoft excel data base file and plot image to illustrate
my question.



my code:

ggplot(concretedata, aes(Company, Concrete, fill=
Type))+geom_bar(stat="identity")

As per the attachment plot, the bar chart for different parameters
(Concrete, Company and Type) is presented, but I dont know how to label
each area of my bar plot.

for example, the bottom left area of my chart should show the sum of
concrete provide by company A with type of C30 (16000 m3)
  or the top right area of my plot should present the total concrete volume
of company B with type of C25. (13000 m3)
but I dont know how to show the total concrete of each area

I know  the command is "geom_text", but it doesnt show the sum of concrete
volume, it shows all the numbers of concrete on top of each other.

thanks
best regards
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] R bar chart

2019-09-07 Thread farshad goudarzian
Hello.
Here I attach a microsoft excel data base file and plot image to illustrate
my question.



my code:

ggplot(concretedata, aes(Company, Concrete, fill=
Type))+geom_bar(stat="identity")

As per the attachment plot, the bar chart for different parameters
(Concrete, Company and Type) is presented, but I dont know how to label
each area of my bar plot.

for example, the bottom left area of my chart should show the sum of
concrete provide by company A with type of C30 (16000 m3)
 or the top right area of my plot should present the total concrete volume
of company B with type of C25. (13000 m3)
but I dont know how to show the total concrete of each area

I know  the command is "geom_text", but it doesnt show the sum of concrete
volume, it shows all the numbers of concrete on top of each other.

thanks
best regards
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Bar chart: break long bars

2011-10-25 Thread Florian Weiler
Dear all,

I have a problem with my stacked bar charts. I have one very long bar, hence
I would like to break the x-axis at a certain point so that the shorter bars
can be seen better.

Here is a cooked up example:
library(lattice)
group - rep(1:3,10)
x - runif(30, 0, 100)
y - runif(30, 0, 100)
x[5] -500
z - rep(seq(1:10),3)
z - z[order(z)]
frame - data.frame(group,x,y,z)
barchart(z ~ y +x | group, data=frame, stack=T,
 col=c(white,grey),
 xlim=c(0,600))

If you run this code, there will be one very long bar in the chart on the
lower right-hand side. All other bars are by construction shorter than 200.
How could I now break the x-axis somewhere around 200 and then continue at,
say, 500? Sorry, I was just unable to figure that out myself.
And given that I'm already posting something, I have another little
question. How could I, in the same graph, turn off that little orange
indicator for the group appearing in the strip?

Thanks a lot for your help,
Florian

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Bar chart: break long bars

2011-10-25 Thread Jim Lemon

On 10/25/2011 09:27 PM, Florian Weiler wrote:

Dear all,

I have a problem with my stacked bar charts. I have one very long bar, hence
I would like to break the x-axis at a certain point so that the shorter bars
can be seen better.

Here is a cooked up example:
library(lattice)
group- rep(1:3,10)
x- runif(30, 0, 100)
y- runif(30, 0, 100)
x[5]-500
z- rep(seq(1:10),3)
z- z[order(z)]
frame- data.frame(group,x,y,z)
barchart(z ~ y +x | group, data=frame, stack=T,
  col=c(white,grey),
  xlim=c(0,600))

If you run this code, there will be one very long bar in the chart on the
lower right-hand side. All other bars are by construction shorter than 200.
How could I now break the x-axis somewhere around 200 and then continue at,
say, 500? Sorry, I was just unable to figure that out myself.
And given that I'm already posting something, I have another little
question. How could I, in the same graph, turn off that little orange
indicator for the group appearing in the strip?


Hi Florian,
Have a look at the gap.barplot function (plotrix).

Jim

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] bar chart issue

2011-07-20 Thread Stratford, Jeffrey
Hi everyone,

 

I determined the presence of three types parasites in a passerine bird
over two years. I would like to create a bar chart that shows the
proportion infected on the y and year/parasite on the x such that each
type of parasite is grouped together (single label) and a bar for each
year .  This would show if there have been changes in the prevalence of
a the parasite over two years. 

 

This is the summary data:

 

ParasiteYear   Infected

Leukocytozoon 2009   0.2564

Plasmodium   2009   0.3846

Hemoproteus2009   0.0769

Leukocytozoon 2010   0.0562

Plasmodium   2010   0.7079

Hemoproteus2010   0.3034

Any2009   0.5128

Any2010   0.7753   

 

Here are rows 86 to 92.  Band and site were recorded differently each
year but these are not part of any calculation. 

 

   Year   band site Plasmodium Hemoproteus Leukocytozoon Any

86 2010 2341-06597 1041  1   1 1   1

87 2010 2341-06598 1041  0   0 0   0

88 2010 2341-06599 1042  1   1 0   1

89 2010 2341-06600 1042  0   1 0   1

90 2009   6443 SOSP0901  0   0 1   1

91 2009   6444 SOSP0902  0   1 0   1

92 2009   6445 SOSP0903  0   0 0   0

 

Any suggestions on how to create this plot would be greatly appreciated.


 

Many thanks,

 

Jeff

 

 

*

Jeffrey A. Stratford, Ph.D.

Department of Health and Biological Sciences

84 W. South St.

Wilkes Univertsity, PA 18766

570-332-2942

http://web.wilkes.edu/jeffrey.stratford/

*




[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] bar chart issue

2011-07-20 Thread Carlos Ortega
Hi Jeff,

One way to graph the differences between the two years for the first set of
data is via barchart(), a function equivalent to barplot in the lattice
package.

Please check if with this portion of code (and with your data) the graph you
get is quite self-explanatory.

###
require(lattice)

Lines-Parasite Year Infected
Leukocytozoon 2009 0.2564
Plasmodium 2009 0.3846
Hemoproteus 2009 0.0769
Leukocytozoon 2010 0.0562
Plasmodium 2010 0.7079
Hemoproteus 2010 0.3034
Any 2009 0.5128
Any 2010 0.7753

DF - read.table(textConnection(Lines),  skip=1, as.is = TRUE,
   col.names=c(Parasite, Year, Infected)
  )


barchart(
 Infected ~ Parasite, data=DF,
 groups=as.factor(Year),
 auto.key = list(space = bottom),
 origin=0
 )

##

Regards,
Carlos Ortega
www.qualityexcellence.es


On Wed, Jul 20, 2011 at 5:56 AM, Stratford, Jeffrey 
jeffrey.stratf...@wilkes.edu wrote:

 Hi everyone,



 I determined the presence of three types parasites in a passerine bird
 over two years. I would like to create a bar chart that shows the
 proportion infected on the y and year/parasite on the x such that each
 type of parasite is grouped together (single label) and a bar for each
 year .  This would show if there have been changes in the prevalence of
 a the parasite over two years.



 This is the summary data:



 ParasiteYear   Infected

 Leukocytozoon 2009   0.2564

 Plasmodium   2009   0.3846

 Hemoproteus2009   0.0769

 Leukocytozoon 2010   0.0562

 Plasmodium   2010   0.7079

 Hemoproteus2010   0.3034

 Any2009   0.5128

 Any2010   0.7753



 Here are rows 86 to 92.  Band and site were recorded differently each
 year but these are not part of any calculation.



   Year   band site Plasmodium Hemoproteus Leukocytozoon Any

 86 2010 2341-06597 1041  1   1 1   1

 87 2010 2341-06598 1041  0   0 0   0

 88 2010 2341-06599 1042  1   1 0   1

 89 2010 2341-06600 1042  0   1 0   1

 90 2009   6443 SOSP0901  0   0 1   1

 91 2009   6444 SOSP0902  0   1 0   1

 92 2009   6445 SOSP0903  0   0 0   0



 Any suggestions on how to create this plot would be greatly appreciated.




 Many thanks,



 Jeff





 *

 Jeffrey A. Stratford, Ph.D.

 Department of Health and Biological Sciences

 84 W. South St.

 Wilkes Univertsity, PA 18766

 570-332-2942

 http://web.wilkes.edu/jeffrey.stratford/

 *




[[alternative HTML version deleted]]

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] bar chart issue

2011-07-20 Thread Jim Lemon

On 07/20/2011 01:56 PM, Stratford, Jeffrey wrote:

Hi everyone,



I determined the presence of three types parasites in a passerine bird
over two years. I would like to create a bar chart that shows the
proportion infected on the y and year/parasite on the x such that each
type of parasite is grouped together (single label) and a bar for each
year .  This would show if there have been changes in the prevalence of
a the parasite over two years.



This is the summary data:



ParasiteYear   Infected

Leukocytozoon 2009   0.2564

Plasmodium   2009   0.3846

Hemoproteus2009   0.0769

Leukocytozoon 2010   0.0562

Plasmodium   2010   0.7079

Hemoproteus2010   0.3034

Any2009   0.5128

Any2010   0.7753



Here are rows 86 to 92.  Band and site were recorded differently each
year but these are not part of any calculation.



Year   band site Plasmodium Hemoproteus Leukocytozoon Any

86 2010 2341-06597 1041  1   1 1   1

87 2010 2341-06598 1041  0   0 0   0

88 2010 2341-06599 1042  1   1 0   1

89 2010 2341-06600 1042  0   1 0   1

90 2009   6443 SOSP0901  0   0 1   1

91 2009   6444 SOSP0902  0   1 0   1

92 2009   6445 SOSP0903  0   0 0   0



Any suggestions on how to create this plot would be greatly appreciated.



Hi Jeff,
I think this could be done with the barNest function, nesting the year 
bars within the parasite bars. If you can't figure it out, send the 
complete dataset and I can provide an example.


Jim

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Bar chart in ascending order for each level of X

2011-07-16 Thread Robert Baer


The question is how to plot a bar chart in which bars are sorted  in 
ascending order for each level of X.  I would appreciate receiving your 
advice and help.

This toy example might help:
barlab - sample(LETTERS,10)
values - sample(1:100, 10)
op - par(mfrow= c(4,1))
barplot(values, names.arg = barlab)
barplot(values[order(values)], names.arg = barlab[order(values)])
barplot(values[order(barlab)], names.arg = barlab[order(barlab)])
ordlabel - c(1,3,5,7,9,2,4,6,8,10)
barplot(values[ordlabel], names.arg = barlab[ordlabel])
par(op)

Rob


Thanks,

Pradip Muhuri

**

The following codes work when producing the chart in which bars are NOT 
sorted.  Please see the output.


* Data File
5.1 8.7 1.6
3.7 7.4 2.8
10.4 12.0 3.5
4.4 8.8 1.7
2.0 3.5 0.7
6.7 11.0 3.1
5.3 6.7 1.8

###
#source(C:/Documents and Settings/pradip.muhuri/My 
Documents/disorders_chart1.R) - Please ignore this line


#R Scripts for bar chart begin here

# Read drug data from tab-delimited data set
drug_data - read.table(C:/Documents and Settings/pradip.muhuri/My 
Documents/xdrug.dat, header=FALSE,

   col.names=c(Age_1217, Age_1825, Age_26Plus),
row.names = c(White,Black,Native American/Alaska 
Native,Hawaiian/OPI,Asian, More than One Race, Hispanic),

sep=\t)

# Graph drug use disorder data with adjacent bars using rainbow colors
barplot(as.matrix(drug_data), main=Past-Year Illicit Drug Use Disorders by 
Race/Ethnicity, ylab= Past-Year Use Disorder Rate (%), beside=TRUE, 
col=rainbow(7))
legend(topright, c(White,Black,Native American/Alaska 
Native,Hawaiian/OPI,Asian, More than One Race, Hispanic), cex=0.6, 
bty=n, fill=rainbow(7));






__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Bar chart in ascending order for each level of X

2011-07-14 Thread Muhuri, Pradip (SAMHSA/CBHSQ)

Hello List,

The question is how to plot a bar chart in which bars are sorted  in ascending 
order for each level of X.  I would appreciate receiving your advice and help.


Thanks,

Pradip Muhuri

**

The following codes work when producing the chart in which bars are NOT sorted. 
 Please see the output.

* Data File
5.1 8.7 1.6
3.7 7.4 2.8
10.412.03.5
4.4 8.8 1.7
2.0 3.5 0.7
6.7 11.03.1
5.3 6.7 1.8

###
#source(C:/Documents and Settings/pradip.muhuri/My 
Documents/disorders_chart1.R) - Please ignore this line

#R Scripts for bar chart begin here

# Read drug data from tab-delimited data set
drug_data - read.table(C:/Documents and Settings/pradip.muhuri/My 
Documents/xdrug.dat, header=FALSE,
col.names=c(Age_1217, Age_1825, Age_26Plus),
row.names = c(White,Black,Native American/Alaska 
Native,Hawaiian/OPI,Asian, More than One Race, Hispanic),
sep=\t)

# Graph drug use disorder data with adjacent bars using rainbow colors
barplot(as.matrix(drug_data), main=Past-Year Illicit Drug Use Disorders by 
Race/Ethnicity, ylab= Past-Year Use Disorder Rate (%), beside=TRUE, 
col=rainbow(7))
legend(topright, c(White,Black,Native American/Alaska 
Native,Hawaiian/OPI,Asian, More than One Race, Hispanic), cex=0.6, 
bty=n, fill=rainbow(7));

Bar_Graph.pdf
Description: Bar_Graph.pdf
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Bar Chart

2011-03-24 Thread Jim Lemon

On 03/24/2011 03:26 AM, blutack wrote:

How do you do a bar chart of 2 vectors?
I have one vector which has 10 numbers, and another which has 10 names.
The numbers are the frequency of the corresponding name, but when I do a bar
chart it says that there is no height. Thanks.


Hi blutack (any relation to Bluto?),
My guess is that you want the frequencies as the heights of the bars and 
the names as the labels of the bars:


heights-sample(10:30,10)
bar_names-c(Oliver,Petroushka,Queequag,Rumplestiltskin,
 Sinbad,Tycho,Uranus,Vesalius,Wojtec,Xavier)
barplot(heights,names.arg=bar_names)

Whoops! Lost some of the labels:

library(plotrix)
barp(heights,names.arg=bar_names,staxx=TRUE)

Jim

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Bar Chart

2011-03-23 Thread blutack
How do you do a bar chart of 2 vectors?
I have one vector which has 10 numbers, and another which has 10 names.
The numbers are the frequency of the corresponding name, but when I do a bar
chart it says that there is no height. Thanks. 

--
View this message in context: 
http://r.789695.n4.nabble.com/Bar-Chart-tp3399924p3399924.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Bar Chart

2011-03-23 Thread David Winsemius


On Mar 23, 2011, at 12:26 PM, blutack wrote:


How do you do a bar chart of 2 vectors?
I have one vector which has 10 numbers, and another which has 10  
names.

The numbers are the frequency of the corresponding name, but when I do


How did you do a barchart? Code please.



a bar
chart it says that there is no height. Thanks.


--
David Winsemius, MD
West Hartford, CT

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Bar Chart

2011-03-23 Thread Francisco Gochez
Hi,

It's difficult to know what is going wrong from what you say below (please
include some reproducible code in the future as indicated in the posting
guide).  If you want to produce a bar chart of the numbers with the
corresponding names as labels for these numbers, you can do something like
this:

x - rnorm(10)
y - letters[1:10] # use the first 10 letters of the alphabet as the labels
barplot(x, names.arg = y)


HTH,

Francisco


On Wed, Mar 23, 2011 at 4:26 PM, blutack x-jess-...@hotmail.co.uk wrote:

 How do you do a bar chart of 2 vectors?
 I have one vector which has 10 numbers, and another which has 10 names.
 The numbers are the frequency of the corresponding name, but when I do a
 bar
 chart it says that there is no height. Thanks.

 --
 View this message in context:
 http://r.789695.n4.nabble.com/Bar-Chart-tp3399924p3399924.html
 Sent from the R help mailing list archive at Nabble.com.

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Bar Chart

2011-03-23 Thread Philipp Pagel
 How do you do a bar chart of 2 vectors?
 I have one vector which has 10 numbers, and another which has 10 names.
 The numbers are the frequency of the corresponding name, but when I do a bar
 chart it says that there is no height. Thanks. 

The first thing we'd need to know is HOW you tried to create the bar
chart. R usually offer quite a lot different ways to tackle a problem
so knowing what exactly you did helps a lot in helping. 

That said, I'll assume you tried the barplot() command which would
work e.g. like this:

v1 - 1:3
v2 - c('A', 'B', 'B')
barplot(v1, names.arg=v2)

If v1 is a named vector things are even easier:

names(v1) - v2
barplot(v1)

As I said, there are a bunch of other ways - e.g. using the lattice function 
barchart() which works a bit differently.

cu
Philipp

-- 
Dr. Philipp Pagel
Lehrstuhl für Genomorientierte Bioinformatik
Technische Universität München
Wissenschaftszentrum Weihenstephan
Maximus-von-Imhof-Forum 3
85354 Freising, Germany
http://webclu.bio.wzw.tum.de/~pagel/

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] bar chart with means - using ggplot

2009-09-12 Thread Dianne Cook

I would recommend not representing means by bars at all.

Bars are for counts, stacking from zero. Means are point estimates.  
ggplot has a lot of routines for displaying means with errors bars:  
geom_linerange, geom_pointrange. To hone your ggplot skills I  
recommend looking into these geoms.



On Sep 11, 2009, at 4:32 PM, Felipe Carrillo wrote:



Like this?

# example using qplot
library(ggplot2)
meanprice - tapply(diamonds$price, diamonds$cut, mean);meanprice
cut - factor(levels(diamonds$cut), levels = levels(diamonds$cut))
qplot(cut, meanprice, geom=bar, stat=identity, fill = I(grey50))
dev.new() # create a new graph to compare with qplot
# Example using ggplot
ggdata - data.frame(meanprice,cut);ggdata
ggplot(ggdata,aes(y=meanprice,x=cut)) +  
geom_bar(fill=grey50,stat='identity')


Felipe D. Carrillo
Supervisory Fishery Biologist
Department of the Interior
US Fish  Wildlife Service
California, USA


--- On Fri, 9/11/09, Andreas Christoffersen  
achristoffer...@gmail.com wrote:



From: Andreas Christoffersen achristoffer...@gmail.com
Subject: bar chart with means - using ggplot
To: ggplot2 ggpl...@googlegroups.com
Date: Friday, September 11, 2009, 1:50 PM

In the help pages hadley provides the following example
showing how to
achieve bar charts with y being means of a variable instead
of counts.
The example uses qplot however - and not ggplot. Since i
would like to
understand ggplot better I would really like to see how
this could be
done in ggplot.

# example using qplot
library(ggplot2)
meanprice - tapply(diamonds$price, diamonds$cut, mean)
cut - factor(levels(diamonds$cut), levels =
levels(diamonds$cut))
qplot(cut, meanprice, geom=bar, stat=identity, fill =
I(grey50))











--~--~-~--~~~---~--~~
You received this message because you are subscribed to the ggplot2  
mailing list.

To post to this group, send email to ggpl...@googlegroups.com
To unsubscribe from this group, send email to
ggplot2+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/ggplot2
-~--~~~~--~~--~--~---



---
Dianne Cook
dic...@iastate.edu

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] bar chart with means - using ggplot

2009-09-11 Thread Felipe Carrillo
Like this?

# example using qplot
library(ggplot2)
meanprice - tapply(diamonds$price, diamonds$cut, mean);meanprice
cut - factor(levels(diamonds$cut), levels = levels(diamonds$cut))
qplot(cut, meanprice, geom=bar, stat=identity, fill = I(grey50))
dev.new() # create a new graph to compare with qplot
 # Example using ggplot
ggdata - data.frame(meanprice,cut);ggdata
ggplot(ggdata,aes(y=meanprice,x=cut)) + geom_bar(fill=grey50,stat='identity')

Felipe D. Carrillo  
Supervisory Fishery Biologist  
Department of the Interior  
US Fish  Wildlife Service  
California, USA


--- On Fri, 9/11/09, Andreas Christoffersen achristoffer...@gmail.com wrote:

 From: Andreas Christoffersen achristoffer...@gmail.com
 Subject: bar chart with means - using ggplot
 To: ggplot2 ggpl...@googlegroups.com
 Date: Friday, September 11, 2009, 1:50 PM
 
 In the help pages hadley provides the following example
 showing how to
 achieve bar charts with y being means of a variable instead
 of counts.
 The example uses qplot however - and not ggplot. Since i
 would like to
 understand ggplot better I would really like to see how
 this could be
 done in ggplot.
 
 # example using qplot
 library(ggplot2)
 meanprice - tapply(diamonds$price, diamonds$cut, mean)
 cut - factor(levels(diamonds$cut), levels =
 levels(diamonds$cut))
 qplot(cut, meanprice, geom=bar, stat=identity, fill =
 I(grey50))
 
 --~--~-~--~~~---~--~~
 You received this message because you are subscribed to the
 ggplot2 mailing list.
 To post to this group, send email to ggpl...@googlegroups.com
 To unsubscribe from this group, send email to
 ggplot2+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/ggplot2
 -~--~~~~--~~--~--~---
 


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] bar-chart help

2008-04-22 Thread Emre Unal
Hi,

I have a table like below outside R environment

 Varible_Name
 Labels
 Bad_Percent
 Good_Percent
 Var1_Postal_Code_Availibility
 1
 0,149367931
 0,850632069

 0
 0,19709687
 0,80290313

Variable_Name column  contains a single entry, the variable name, this is
the title of the graphic

I want to plot  a barchart  Bad_Percent (blue) versus Good_Percent (red)
within each Label

Thanks a lot for your help
Regards,
Emre
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] bar-chart help

2008-04-22 Thread Richard . Cotton
 I have a table like below outside R environment
 
  Varible_Name
  Labels
  Bad_Percent
  Good_Percent
  Var1_Postal_Code_Availibility
  1
  0,149367931
  0,850632069
 
  0
  0,19709687
  0,80290313
 
 Variable_Name column  contains a single entry, the variable name, this 
is
 the title of the graphic
 
 I want to plot  a barchart  Bad_Percent (blue) versus Good_Percent (red)
 within each Label

This sounds like a simple problem to solve, but you'll have to tell us 
more.  Which bit are you having problems with, getting the data into R in 
a suitable form, or plotting the barchart?

Take a look at the function ?read.table for reading in your data, and 
?barplot for plotting.

Regards,
Richie.

Mathematical Sciences Unit
HSL



ATTENTION:

This message contains privileged and confidential inform...{{dropped:20}}

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Bar Chart help!

2008-04-22 Thread john.hogan

Hi there,

Im working with a bar chart. I want to create a bar chart using the
followinf file:
gender relationship
Male  Manage
Male  Manager
Male  Manager
Male  Manager
Male  Clerical
Male  Manager
Male  Manager
Male  Manager
Male  Manager

Im trying to represent in the chart that there are nine males, 8 are
managers and 1 is clerical. I have created a bar chart that shows there are
9 males but my 2nd bar wont display the correct info. It says there are only
2 managers and 2 clerical staff. Here is the code I am using:

female_clerical
-read.table(C://project/graphs/gender/breakdown/male-relationship.csv,
sep=,, header=TRUE)
barp(rbind(rep(length(female_clerical$gender),2),(female_clerical$relationship)[[1]]),
col=4:5,names.arg=c(Clerical - 1,Manager - 8))
legend(2.1,8,c(Male (9),Position),fill=4:5)

Anyone got any suggestions?

Hope to hear from someone soon.

BR,

John.
-- 
View this message in context: 
http://www.nabble.com/Bar-Chart-help%21-tp16824435p16824435.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.