-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
00641de
commit 6e18621
Showing
4 changed files
with
87 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
dados = read.csv("dados/TableSessionLengthForaDeAula.csv") | ||
dados <- subset(dados,select=c(data.hora,timeSession)) | ||
dados$data.hora<-strptime(dados$data.hora,"%m/%d/%Y") | ||
dados$timeSession<-dados$timeSession/3600 | ||
fix(dados) | ||
dados <-aggregate(dados$timeSession, list("data.hora" = dados$data.hora), FUN = mean) | ||
|
||
library(ggplot2) | ||
library(scales) | ||
|
||
#Definindo o tema padrao em todos os plots | ||
|
||
theme_white <- function() { | ||
theme_update(#tamanho do texto do eixo x e y | ||
axis.title = element_text(size=16), | ||
#tamanho do texto dos valores do eixo x e y | ||
axis.text = element_text(size=14), | ||
#removendo a caixa da legenda | ||
legend.title = element_blank(), | ||
#Tamanho do texto da legenda | ||
legend.title = element_text(size = 16), | ||
legend.text = element_text(size = 16) | ||
) | ||
} | ||
|
||
theme_set(theme_bw()) | ||
theme_white() | ||
|
||
|
||
plot <- ggplot(dados, aes(as.Date(data.hora),x)) + geom_line()+ | ||
labs(x = "Datas", y = "Tamanho M�dio das Sess�es") + | ||
scale_x_date(breaks = "1 week",labels = date_format("%d/%m"))+scale_y_continuous(breaks=c(0,0.5,1.0,1.5)) + theme_white()+ | ||
geom_segment(aes(x = as.Date("2011-09-17"), y = 0, xend = as.Date("2011-09-17"), yend = 1.5, color ="Prova 1"), size = 1.2)+ | ||
geom_segment(aes(x = as.Date("2011-10-29"), y = 0, xend = as.Date("2011-10-29"), yend = 1.5, color ="Prova 2"), size = 1.2)+ | ||
geom_segment(aes(x = as.Date("2011-11-26"), y = 0, xend = as.Date("2011-11-26"), yend = 1.5, color ="Prova 3"), size = 1.2)+ | ||
geom_segment(aes(x = as.Date("2011-12-03"), y = 0, xend = as.Date("2011-12-03"), yend = 1.5, color ="Prova Final"), size = 1.2) | ||
|
||
|
||
png(filename = "Grafico_us7_tamanhoMedioSessoes.png", width = 850, height = 480) | ||
plot | ||
dev.off() | ||
|
||
pdf(file = ifelse(TRUE, "Grafico_us7_tamanhoMedioSessoes.pdf", "Grafico_us7_tamanhoMedioSessoes.pdf")) | ||
plot | ||
dev.off() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
library(plyr) | ||
library(ggplot2) | ||
library(scales) | ||
|
||
|
||
dados = read.csv("dados/TableSessionLengthForaDeAula.csv",header=T) | ||
dados$data.hora<-strptime(dados$data.hora,"%m/%d/%Y") | ||
|
||
df <- count(dados,"data.hora") | ||
|
||
|
||
#Definindo o tema padrao em todos os plots | ||
|
||
theme_white <- function() { | ||
theme_update(#tamanho do texto do eixo x e y | ||
axis.title = element_text(size=16), | ||
#tamanho do texto dos valores do eixo x e y | ||
axis.text = element_text(size=14), | ||
#removendo a caixa da legenda | ||
legend.title = element_blank(), | ||
#Tamanho do texto da legenda | ||
legend.title = element_text(size = 16), | ||
legend.text = element_text(size = 16) | ||
) | ||
} | ||
|
||
theme_set(theme_bw()) | ||
theme_white() | ||
|
||
grafico<- ggplot(df, aes(as.Date(data.hora),freq)) + geom_line()+ | ||
labs(x = "Datas", y = "N�mero Total de Sess�es") + | ||
scale_x_date(breaks = "1 week",labels = date_format("%d/%m")) + theme_white()+ | ||
geom_segment(aes(x = as.Date("2011-09-17"), y = 0, xend = as.Date("2011-09-17"), yend = 105, color ="Prova 1"), size = 1.2)+ | ||
geom_segment(aes(x = as.Date("2011-10-29"), y = 0, xend = as.Date("2011-10-29"), yend = 105, color ="Prova 2"), size = 1.2)+ | ||
geom_segment(aes(x = as.Date("2011-11-26"), y = 0, xend = as.Date("2011-11-26"), yend = 105, color ="Prova 3"), size = 1.2)+ | ||
geom_segment(aes(x = as.Date("2011-12-03"), y = 0, xend = as.Date("2011-12-03"), yend = 105, color ="Prova Final"), size = 1.2) | ||
|
||
|
||
png(filename = "Grafico_us7_totalSessoes.png", width = 850, height = 480) | ||
print(grafico) | ||
dev.off() |