Home coloured histogram variable in rstudio
Reply: 0

coloured histogram variable in rstudio

user882
1#
user882 Published in August 15, 2018, 11:17 am

From this linkEXCEL FILE

I wrote that code

library(ggplot2)

manze<-manze_ZAMBELLONI
manze$DAGE<-as.numeric(manze$DAGE)

ggplot(manze, aes(DAGE))+
  geom_histogram(col="black", aes(fill=RPRO), bins=20)+
  geom_density(aes(y=50*..count..), alpha=0.2)`

And got that nice histogram:

So the question is: for several reasons, sometimes I prefer working with default Rstudio histograms, and I think I know how to do that, except I don't know how to colour by reproductive status, so that's what I am getting

hist(manze$DAGE, breaks = 30, prob=T, col="grey") 
grid() 
lines(density(manze$DAGE), col="blue", lwd=3)
axis(side=1, at=seq(0,900,50))

So; how to colour by reproductive status adding an order to this second syntax?

Many thanks and kind regards.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.295401 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO