Graphics Reference
In-Depth Information
Figure 3-9. A variable mapped to fill
Discussion
The default colors aren't very appealing, so you may want to set them, using
scale_fill_brewer() or scale_fill_manual() . With this example, we'll use the latter, and
we'll set the outline color of the bars to black, with colour="black" ( Figure 3-10 ) . Note that
settingoccurs outside of aes() , while mappingoccurs within aes() :
ggplot(upc, aes(x = reorder(Abb, Change), y = Change, fill = Region)) +
geom_bar(stat = "identity" , colour = "black" ) +
scale_fill_manual(values = c( "#669933" , "#FFCC66" )) +
xlab( "State" )
Search WWH ::




Custom Search