-
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
f5a345b
commit c0a20b1
Showing
1 changed file
with
54 additions
and
0 deletions.
There are no files selected for viewing
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,54 @@ | ||
library(plyr) | ||
library(ggplot2) | ||
library(scales) | ||
|
||
|
||
dados = read.csv("dados/TableSessionLength.csv",header=T) | ||
dados$data.hora<-strptime(dados$lastSubmission,"%Y-%m-%d") | ||
|
||
df <- count(dados,"data.hora") | ||
|
||
provas_data = c("2011-09-17","2011-10-29","2011-11-26","2011-12-03") | ||
Avaliacao = c("Avaliação 1", "Avaliação 2","Avaliação 3","Avaliação Final") | ||
|
||
#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) | ||
) | ||
} | ||
|
||
grafico<- ggplot(df, aes(x=as.Date(data.hora),y=freq)) + | ||
geom_line()+ | ||
labs(x = "Datas", y = "Número Total de Sessões") + | ||
scale_x_date(breaks = "2 week",labels = date_format("%d/%m"))+ | ||
scale_y_continuous(limits=c(0,150)) + | ||
theme_white()+ | ||
geom_segment(aes(x = as.Date(provas_data), y = 0, xend = as.Date(provas_data), yend = 140, linetype =Avaliacao),size = 1.2)+ | ||
theme(legend.position = c(0.14, 0.8), legend.title = element_blank(),legend.text=element_text(size=10)) | ||
|
||
|
||
grafico2<- ggplot(df, aes(x=as.Date(data.hora),y=freq)) + | ||
geom_line()+ | ||
labs(x = "Datas", y = "Número Total de Sessões") + | ||
scale_x_date(breaks = "2 week",labels = date_format("%d/%m"))+ | ||
scale_y_continuous(limits=c(0,150)) + | ||
theme_bw()+ | ||
geom_segment(aes(x = as.Date(provas_data), y = 0, xend = as.Date(provas_data), yend = 140, linetype =Avaliacao),size = 1.2)+ | ||
theme(legend.position = c(0.125, 0.82), legend.title = element_blank(),legend.text=element_text(size=8)) | ||
|
||
png(filename = "Grafico_us7_totalSessoes.png", width = 550, height = 350) | ||
print(grafico) | ||
dev.off() | ||
|
||
pdf("Grafico_us7_totalSessoes.pdf", width = 5.5, height = 3.5) | ||
print(grafico2) | ||
dev.off() |