6.1 Bar Charts 6.1.1 stacked bars and grouped bars
Library (VCD) library (GRID) counts<-table (arthritis$improved,arthritis$treatment) Countsbarplot (counts, main= "Stacked Bar Plot", xlab= "treatment", ylab= "Frequency", Col=c ("Red", "yellow", "green"), legend= Rownames (counts)) #legend provide labels
Library (VCD) library (GRID) counts<-table (arthritis$improved,arthritis$treatment) Countsbarplot (counts, main= "Stacked Bar Plot", xlab= "treatment", ylab= "Frequency", Col=c ("Red", "yellow", "green"), legend= Rownames (counts), beside = TRUE) #beside indicates that each column in the matrix represents a grouping, and the values in the columns are tied instead of stacked
6.1.2 Spine-like chart
Library (VCD) library (grid) attach (arthritis) counts<-table (treatment,improved) Countsspine (counts, main= " Stacked Bar Plot ") Detach (arthritis)
Sixth Chapter Simple Graphics