7
Al momento ho un diagramma simile a questo:Overlay due geom_bar come due barplots con parc (nuovo = TRUE)
sourceTable<-"dateValues;total;inHospital
2014-01-01; 80; 20
2014-01-02; 90; 15
2014-01-03; 98; 16
2014-01-04; 98; 17
2014-01-05; 100; 28
2014-01-06; 110; 28
2014-01-07; 122; 30
2014-01-08; 110; 25
2014-01-09; 100; 22
2014-01-00; 90; 20
2014-01-11; 90; 15
2014-01-12; 80; 13
2014-01-13; 82; 10"
timetable<-read.table(textConnection(sourceTable), sep=";", head=T, dec=",")
barplot(timetable$total, border="red", axes=FALSE, ylim=c(0, max(timetable$total)))
par(new=TRUE)
barplot(timetable$inHospital, border="blue", axes=FALSE, ylim=c(0, max(timetable$total)))
che mi dà questa trama:
Esiste un modo per farlo con ggplot e geom_bar come questo:
library(ggplot2)
ggplot(timetable, aes(x=dateValues, y=total))
+geom_bar(stat="identity", fill="red", colour="red")
Come posso sovrapporre un secondo ggp molto sopra il primo, vale a dire:
ggplot(timetable, aes(x=dateValues, y=inHospital))
+geom_bar(stat="identity", fill="red", colour="blue")
seconda versione è ancora meglio !!! Grazie per aver condiviso questo !!! –