Skip to main content.
search :
Add to Google

back to back histogram

Last Modified : 13/01/2006 04:57, 16 lines of code
Highlighting powered by highlight

   
options(digits=3) 
set.seed(1)

require(Hmisc) 

age <- rnorm(1000,50,10) 
sex <- sample(c('female','male'),1000,TRUE) 
out <- histbackback(split(age, sex), probability=TRUE, xlim=c(-.06,.06), 
                    main = 'Back to Back Histogram')


#! just adding color
barplot(-out$left, col="red" , horiz=TRUE, space=0, add=TRUE, axes=FALSE) 
barplot(out$right, col="blue", horiz=TRUE, space=0, add=TRUE, axes=FALSE) 

back to back histogram

The two histogram are plotted back to each other.

Note

40.93 / 100   (225 votes)
Vote (between 0 and 100) :

Requirements

source code

Download or view
RGraphGallery(136,9,9)

packages

The following packages will be needed to produce that graph

Hmisc

Keywords

bioconductor
Cluster analysis
Dimension: multivariate
Dimension: univariate
Mathematical annotations
Quantile regression
Rcore: colors
Rcore: core
Rcore: fonts
system: graphics
system: grid
system: lattice
system: rgl
triplot
Var: circular
Var: factor
Var: TimeSeries
View: distribution
View: linear relation
View: spatial
View: trees
add a keyword
just click a keyword to associate it to that graph. If you don't find what you are looking for, you may also create a new keyword.
 3D
 bioconductor
 Cluster analysis
 Dimension:
         bivariate
         multivariate
         univariate
 histogram
 Mathematical annotations
 Quantile regression
 Rcore:
         colors
         core
         fonts
 system:
         graphics
         grid
         lattice
         rgl
 triplot
 Var:
         circular
         factor
         numeric
         TimeSeries
 View:
         distribution
         linear relation
         spatial
         trees

See also ...

Wiki page

 Go to the wiki page associated to that graphic. Feel free to add comments, etc ... there.
Warning: fopen(http://wiki.r-project.org/rwiki/doku.php?id=graph_gallery:graph136&do=export_raw) [function.fopen]: failed to open stream: HTTP request failed! HTTP/1.0 403 Forbidden in /mnt/114/free.fr/2/c/addictedtor/graphiques/scriptsphp/bottom_graph.php on line 181

Warning: fread(): supplied argument is not a valid stream resource in /mnt/114/free.fr/2/c/addictedtor/graphiques/scriptsphp/bottom_graph.php on line 182

Author(s)

Patrick Burns