It appears I broke ggplot in my script, but that maybe it is because the 
caffeine has worn off or maybe it is late in the day.   I thought I was 
beginning to understand ggplot, but I have encountered a silly little issue. 
 
For some reason the following does not produce a histogram with fill due to the 
Person's characteristics: 
(Note that VADeaths_flat_df$Data works fine...)
 
 
VADeaths_df<-data.frame(VADeaths)
VADeaths_flat_tmp1<-data.frame(Data=as.numeric(as.character(VADeaths_df$Rural.Male)),
 Person="Rural.Male")
VADeaths_flat_tmp2<-data.frame(Data=as.numeric(as.character(VADeaths_df$Rural.Female)),
 Person="Rural.Female")
VADeaths_flat_tmp3<-data.frame(Data=as.numeric(as.character(VADeaths_df$Urban.Male)),
 Person="Urban.Male")
VADeaths_flat_tmp4<-data.frame(Data=as.numeric(as.character(VADeaths_df$Urban.Female)),
 Person="Urban.Female")

VADeaths_flat_df<-rbind(VADeaths_flat_tmp1, VADeaths_flat_tmp2)
VADeaths_flat_df<-rbind(VADeaths_flat_df, VADeaths_flat_tmp3)
VADeaths_flat_df<-rbind(VADeaths_flat_df, VADeaths_flat_tmp4)
bin_size<-15.0
ggplot(VADeaths_flat_df, aes(x = factor(Data), fill = factor(Person))) + 
geom_bar(position=position_dodge(width =(20)), binwidth=20)
# or 
ggplot(VADeaths_flat_df, aes(x=factor(Data))) + geom_histogram(binwidth=20)  
 
Thanks again for any feedback you provide. 


      
        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to