Browse Source

Arreglar gráficos para exportar cuando es de vacunación.

master
marcelcosta 2 years ago
parent
commit
2f676e7632
1 changed files with 14 additions and 3 deletions
  1. +14
    -3
      invivos/app.R

+ 14
- 3
invivos/app.R

@ -586,10 +586,21 @@ server <- function(input, output) {
if (input$fig_id %in% c("Cinética Grupo", "Cinética Individual")){ if (input$fig_id %in% c("Cinética Grupo", "Cinética Individual")){
if (input$fig_id == "Cinética Grupo"){ if (input$fig_id == "Cinética Grupo"){
if (input$vacc == "Sí"){ if (input$vacc == "Sí"){
std<-function(x, na.rm=T){sd(x, na.rm=na.rm)/sqrt(length(x))}
errbar<-table %>% group_by(Group,`ID tumor`, Timepoint) %>%
summarise(mean=mean(Volume, na.rm=T), std=std(Volume)) %>%
mutate(Timepoint2=as.numeric(as.character(Timepoint))) %>%
mutate(x=Timepoint2-input$`errorbar-width`, xend=Timepoint2+input$`errorbar-width`)
g<-ggplot(table, aes(as.numeric(as.character(Timepoint)), Volume, color=Group, group=Group))+ g<-ggplot(table, aes(as.numeric(as.character(Timepoint)), Volume, color=Group, group=Group))+
scale_x_continuous(expand = expansion(mult = c(0,0.05)), limits = c(0, (round(max(as.numeric(as.character(table$Timepoint))) / 5)+1)*5))+
scale_x_continuous(expand = expansion(mult = c(0,0.0)),
breaks=sort(unique(errbar$Timepoint2)),
limits = c(0,max(as.numeric(as.character(table$Timepoint)))*1.1))+
facet_grid(factor(`ID tumor`, labels = c("Vaccination", "Rechallenge"))~., scale="free_y")+ facet_grid(factor(`ID tumor`, labels = c("Vaccination", "Rechallenge"))~., scale="free_y")+
theme_bw()
theme_bw()+
geom_segment(data=errbar, aes(y=mean, yend=mean+std, x=Timepoint2, xend=Timepoint2))+
geom_segment(data=errbar, aes(y=mean+std, yend=mean+std,
x=x,xend=xend))
}else{ }else{
std<-function(x, na.rm=T){sd(x, na.rm=na.rm)/sqrt(length(x))} std<-function(x, na.rm=T){sd(x, na.rm=na.rm)/sqrt(length(x))}
errbar<-table %>% group_by(Group, Timepoint) %>% errbar<-table %>% group_by(Group, Timepoint) %>%
@ -612,7 +623,7 @@ server <- function(input, output) {
if (input$vacc == "Sí"){ if (input$vacc == "Sí"){
g<-ggplot(table, aes(as.numeric(as.character(Timepoint)), Volume, color=Group, group=`ID animal`))+ g<-ggplot(table, aes(as.numeric(as.character(Timepoint)), Volume, color=Group, group=`ID animal`))+
scale_x_continuous(expand = expansion(mult = c(0,0.0)), scale_x_continuous(expand = expansion(mult = c(0,0.0)),
breaks=sort(unique(errbar$Timepoint2)),
breaks=sort(unique(as.numeric(as.character(table$Timepoint)))),
limits = c(0, (round(max(as.numeric(as.character(table$Timepoint))) / 5)+1)*5))+ limits = c(0, (round(max(as.numeric(as.character(table$Timepoint))) / 5)+1)*5))+
facet_grid(factor(`ID tumor`, labels = c("Vaccination", "Rechallenge"))~Group, scale="free_y")+ facet_grid(factor(`ID tumor`, labels = c("Vaccination", "Rechallenge"))~Group, scale="free_y")+
theme_bw() theme_bw()

Loading…
Cancel
Save