Skip to content

Instantly share code, notes, and snippets.

@euclidjda
Last active August 29, 2015 14:23
Show Gist options
  • Save euclidjda/ae565ce79cbff4501bbb to your computer and use it in GitHub Desktop.
Save euclidjda/ae565ce79cbff4501bbb to your computer and use it in GitHub Desktop.
Plotting class densities example for machine learning classification - example #2
library(ggplot2)
library(mlbench)
data(PimaIndiansDiabetes)
p <- ggplot( PimaIndiansDiabetes,
aes( x=glucose, fill=diabetes))+
geom_histogram(alpha=0.4,position="identity")+
xlab("diabetes")+
scale_y_continuous("Number of Observations")
p + guides(fill=guide_legend(title=NULL)) +
scale_fill_discrete(labels=c("Diabetes Negative","Diabetes Positive")) +
theme(legend.position=c(1,1),legend.justification=c(1,1))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment