Created
December 6, 2013 18:01
-
-
Save uribo/7829363 to your computer and use it in GitHub Desktop.
Frequency histogram with negative value.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
d.class <- seq(25, 200, by=25) # DBH class | |
class <- c() | |
for(i in 1 : (length(d.class) - 1)){ | |
class <- append(class, paste(d.class[i], "-" ,d.class[i + 1], "cm")) | |
} | |
imm.class1 <- c(30, 20, 10, 5, 0, 0, 0) | |
imm.class2 <- c(0, 0, 5, 10, 5, 0, 0) | |
imm.class3 <- c(0, 0, 0, 0, 5, 2, 0) | |
immature <- matrix( | |
rbind(imm.class1, imm.class2, imm.class3), | |
nrow=3 | |
) | |
#rownames(immature) <- c("class1", "class2", "class3") | |
#colnames(immature) <- c(class) | |
mat.class1 <- c(0, 0, 0, 0, 0, 0, 0) | |
mat.class2 <- c(0, 0, 5, 10, 8, 5, 0) | |
mat.class3 <- c(0, 0, 2, 10, 15, 20, 20) | |
mature <- matrix( | |
rbind(mat.class1, mat.class2, mat.class3), | |
nrow=3 | |
) | |
#rownames(mature) <- c("class1", "class2", "class3") | |
#colnames(mature) <- c(class) | |
yrange <- c(-40, 40) | |
COL <- c("tomato", "turquoise", "purple") | |
par(mar=c(7, 4, 4, 2)) | |
barplot( | |
immature, | |
ylim=yrange, | |
las=2, | |
space=0, | |
names.arg=class, | |
col=COL, | |
ylab="# ind.") | |
par(new=T) | |
barplot( | |
-mature, | |
ylim=yrange, | |
space=0, | |
axes=F, | |
las=2, | |
col=COL) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment