Introduction to R for Ecologists
R語言在生態學的應用
EEB5082 (B44U1940)
Author: David Zelený
Permalink: davidzeleny.net/link/recol
Introduction to R for Ecologists
R語言在生態學的應用
EEB5082 (B44U1940)
Author: David Zelený
Permalink: davidzeleny.net/link/recol
png (file = 'colours_1.png', height = 250, width = 550, units = 'px', pointsize = 16) barplot (rep (1, 9), col = 0:8, names.arg = 0:8, axes = F, main = 'col = ') dev.off () png (file = 'colours_2.png', height = 550, width = 550, units = 'px', pointsize = 16) cols_num <- c(1, 2, 3) barplot (1:3, col = cols_num) dev.off () png (file = 'colours_3.png', height = 550, width = 550, units = 'px', pointsize = 16) cols_name <- c("red", "blue", "tomato") barplot (1:3, col = cols_name) dev.off () png (file = 'colours_4.png', height = 550, width = 550, units = 'px', pointsize = 16) cols_rgb <- c(rgb (red = 1, green = 0, blue = 0), # red colour rgb (red = 0, green = 0.5, blue = 0), # dark green colour (lower intensity of green channel) rgb (red = 1, green = 0.82, blue = 0.86)) # mixing all three chanels result in pink here barplot (1:3, col = cols_rgb) dev.off () png (file = 'colours_5.png', height = 550, width = 550, units = 'px', pointsize = 16) cols_hex <- c("#FF0000", "#008000", "#FFD1DC") # red, dark green, and pink barplot (1:3, col = cols_hex) dev.off () png (file = 'colours_6.png', height = 550, width = 550, units = 'px', pointsize = 16) cols_rb1 <- rainbow (3) barplot (1:3, col = cols_rb1) dev.off () png (file = 'colours_7.png', height = 550, width = 550, units = 'px', pointsize = 16) cols_rb2 <- rainbow (20) barplot (1:20, col = cols_rb2) dev.off png (file = 'colours_8.png', height = 550, width = 550, units = 'px', pointsize = 16) library (RColorBrewer) cols_rcb <- brewer.pal (n = 3, name = 'Dark2') barplot (1:3, col = cols_rcb) dev.off ()