6.1 DEFINING COLOURS

  col= 1          # black
  col= c(1,2,3)   # vector of colours 1,2,3
  col= c(1:3)     # range of colours 1 to 3 - same as above
# specify colour by name
  col= "grey"     
  col= c("grey10","grey30","grey80")
par(mfrow=c(1,1),mar=c(3,0,2,0))
x <- rep(1:8)
y <- rep(1, times = 8)
plot(x,y, col= 1:8, pch= 15, cex= 3, ylim= c(0,2), yaxt= "n",
     main= "Colour Numbers in R: 'col = 1 to 8'")

6.2 DEFINING SYMBOLS (POINTS)

  pch= 1              
  pch= c(1,2,3)      
  pch= c(1:3)         
  pch= "A"            
  pch= c("N","S","E","W")
  pch= c(1:3)
  cex= 0.5        
  pch= c(1,2,3)
  cex= 1.2
  pch= 1
  col= 4          
  pch= 21
  col= 3
  bg= 1 

  pch= c(1,2,5)
  cex= 1.2 
  col= c(2:4) 

  with(mtcars, plot(mpg ~ cyl, pch=c(16,17,18), cex= 1.9, col= c(1:10), bg=1))

6.3 DEFINING LINE TYPES

  lty= 1             
  lty= c(1,5,3)       
  lty= c(1:6)       
  lty= 1
  lwd= 0.5        
  lty= c(1,2,3)
  lwd= 1.2 
  lty= 1
  col= 4          
  lty= c(1,5)
  col= c(3,4)  
  lty= c(1,2,3)
  col= 2
  lwd= c(2:4) 
plot(mtcars$mpg)
abline(v=c(5, 10), col =c(4,4), lty= c(3,2),lwd=c(1,2))

6.4 SAVING PLOTS

png("Figure1.png", width = 100, height = 100, units = 'mm', res = 300)
with(PlantGrowth,hist(weight,
      xlim= c(3,7),                     
      ylim= c(0,10),                    
      col= "lightgray",                   
      border= "black",                    
      main= "Histogram of Plant Weights",
      xlab= "Dried weight (g)",          
      ylab= "Frequency"))                 


dev.off()
## png 
##   2