Browse Source

Cambios en los gráficos de líneas en la exportación.

master
marcelcosta 2 years ago
parent
commit
c5229e858a
1 changed files with 27 additions and 7 deletions
  1. +27
    -7
      invivos/app.R

+ 27
- 7
invivos/app.R

@ -63,7 +63,8 @@ ui <- fluidPage(
sliderInput("width", "Ancho", min=1000, max=20000, step=1000, value=10000), sliderInput("width", "Ancho", min=1000, max=20000, step=1000, value=10000),
sliderInput("height", "Altura", min=1000, max=20000, step=1000, value=6000), sliderInput("height", "Altura", min=1000, max=20000, step=1000, value=6000),
textInput("colors", label="Colors", value=""), textInput("colors", label="Colors", value=""),
sliderInput("errorbar-width", "% Ancho errorbars", min=0.05, max=1, step=0.05, value=0.05),
sliderInput("errorbar-width", "% Ancho errorbars", min=0.0, max=1, step=0.05, value=0.05),
sliderInput("line-size", "Tamaño línea", min=0.1, max=3, step=0.1, value=0.5),
sliderInput("point-size", "Tamaño puntos", min=1, max=10, step=1, value=3), sliderInput("point-size", "Tamaño puntos", min=1, max=10, step=1, value=3),
sliderInput("font-size", "Tamaño textos", min=5, max=30, step=1, value=11), sliderInput("font-size", "Tamaño textos", min=5, max=30, step=1, value=11),
checkboxInput(inputId = "logscale", label="Escala logarítmica eje Y", value=F), checkboxInput(inputId = "logscale", label="Escala logarítmica eje Y", value=F),
@ -590,25 +591,44 @@ server <- function(input, output) {
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()
}else{ }else{
g<-ggplot(table, aes(Timepoint, Volume, color=Group, group=Group))+
theme_bw()
std<-function(x, na.rm=T){sd(x, na.rm=na.rm)/sqrt(length(x))}
errbar<-table %>% group_by(Group, 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))+
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))+
# limits = c(0, (round(max(as.numeric(as.character(table$Timepoint))) / 5)+1)*5))+
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))
} }
} }
if (input$fig_id == "Cinética Individual"){ if (input$fig_id == "Cinética Individual"){
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.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, (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()
}else{ }else{
g<-ggplot(table, aes(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)),
breaks=sort(unique(as.numeric(as.character(table$Timepoint)))),
limits = c(0,max(as.numeric(as.character(table$Timepoint)))*1.1))+
facet_wrap(.~Group)+ facet_wrap(.~Group)+
theme_bw() theme_bw()
} }
} }
g<-g+geom_errorbar(stat="summary", width=input$`errorbar-width`)+
geom_line(stat="summary")+
g<-g+
# geom_errorbar(stat="summary", width=input$`errorbar-width`)+
geom_line(stat="summary", size=input$`line-size`)+
geom_point(stat="summary", size=input$`point-size`)+ geom_point(stat="summary", size=input$`point-size`)+
labs(x="Days after tumor challenge")+ labs(x="Days after tumor challenge")+
scale_y_continuous(expand = expansion(mult = c(0,0.05))) scale_y_continuous(expand = expansion(mult = c(0,0.05)))

Loading…
Cancel
Save