Graphics Reference
In-Depth Information
able,
smoke
, is stored as a number, so we'll use the
birthwt1
data set we created above, in which
smoke is a factor:
# Convert smoke to a factor
birthwt1$smoke
<-
factor(birthwt1$smoke)
# Map smoke to fill, make the bars NOT stacked, and make them semitransparent
ggplot(birthwt1, aes(x
=
bwt, fill
=
smoke))
+
geom_histogram(position
=
"identity"
, alpha
=
0.4
)