Skip to content
Snippets Groups Projects
Commit 00bad0bf authored by Berinda van Dijk's avatar Berinda van Dijk
Browse files

multiple changes in the barplots: now there is something like facet_wrap used....

multiple changes in the barplots: now there is something like facet_wrap used. And removed the plotly 'stippenplot'.
parent ca661f44
Branches
No related tags found
1 merge request!11barplots and plotted tables
......@@ -133,40 +133,33 @@ doId <- function(input) {
plottabel_LastSwam<-plottabel_LastSwam %>% layout(title='Last swam par distance and pooltype')
appendPlotly(plottabel_LastSwam)
testplot=ggplot(tabel_Prs[order(tabel_Prs$stroke),], aes(fill=distance, y=points, x=AfstandSlag, label=stroke))+
geom_col(position=position_dodge2(preserve='single'))+ylim(0, NA)+
scale_fill_manual(values=kleurenset_afstanden, limits=force)+
theme(axis.text.x = element_text(angle = 45, hjust=0))+
labs(title = "Barplot_rotatedlabels- gesplitst label")+scale_x_discrete(labels=tabel_Prs$distance)+
geom_text(aes(y=max(tabel_Prs$points)))#Nu nog alleen de middelste van elke slag selecteren, en alleen die data labelen.
#En goed sorteren van de bars.
appendPlot(testplot)
breedte_perslag=unique(tabel_Prs[, c('distance', 'stroke')]) %>% group_by(stroke) %>%count()
breedte_perslag=breedte_perslag$n
breedte_perslag=breedte_perslag/(breedte_perslag%>%sum())
barplot_rotatedlabels<-ggplot(tabel_Prs, aes(fill=distance, y=points, x=AfstandSlag, label=poolType, text=date))+
geom_col(position=position_dodge2(preserve='single'))+
scale_fill_manual(values=kleurenset_afstanden, limits=force)+
theme(axis.text.x = element_text(angle = 45, hjust=1))+
labs(title = "Barplot_rotatedlabels- prs")
barplot_rotatedlabels<-ggplotly(barplot_rotatedlabels, tooltip=c('label', 'text', 'y'))%>%
layout(dragmode=FALSE)
appendPlotly(barplot_rotatedlabels)
barplot_facets<-function(x){
ggplotly(
ggplot(data=x, aes(fill=distance, y=points, x=distance, label=poolType, text=date))+
geom_col(position=position_dodge2(preserve='single'))+
scale_fill_manual(values=kleurenset_afstanden, limits=force)+
scale_y_continuous(expand=c(0,0), limits=c(0, max(tabel_Prs$points)+15))+
theme(panel.grid.major = element_blank())+ggtitle(" ")+
facet_wrap(.~stroke, scales='free_x'),
tooltip=c('x', 'y', 'label', 'text'))}
tabel_LastEntrys<-tabel_LastEntrys[order(tabel_LastEntrys$poolType),]
barplot_lastentrys=ggplot(tabel_LastEntrys[tabel_LastEntrys$points!=0,],
aes(fill=distance, y=points, x=AfstandSlag, label=poolType, text=date))+
geom_col(position=position_dodge2(preserve='single'))+
scale_fill_manual(values=kleurenset_afstanden, limits=force)+
theme(axis.text.x = element_text(angle = 45, hjust=1))+
labs(title = "Barplot_rotatedlabels- last entrys")
barplot_lastentrys<-ggplotly(barplot_lastentrys, tooltip=c('label', 'text', 'y'))%>%
layout(dragmode=FALSE)
appendPlotly(barplot_lastentrys)
facetwrap_prs=tabel_Prs[order(tabel_Prs$poolType),] %>% split(.$stroke) %>%map(barplot_facets)
facetwrap_prs=facetwrap_prs %>% subplot(widths=breedte_perslag, margin=0.01, shareY=TRUE) %>%
layout(showlegend=FALSE, dragmode=FALSE, title='Prs')
appendPlotly(facetwrap_prs)
bovennul_sorted=bovennul[order(bovennul$distance, decreasing=TRUE),]
stippenplot_plotly<-plot_ly(data=bovennul_sorted, x=~date, y=~points, type='scatter', mode='markers', color=~stroke)
appendPlotly(stippenplot_plotly)
tabel_lasts=tabel_LastEntrys[order(tabel_LastEntrys$poolType),]
tabel_lasts=tabel_lasts[tabel_lasts$points!=0,]
facetwrap_lasts=tabel_lasts %>% split(.$stroke) %>%map(barplot_facets)
facetwrap_lasts=facetwrap_lasts %>% subplot(widths=breedte_perslag, margin=0.01, shareY=TRUE) %>%
layout(showlegend=FALSE, title='Last entrys')
appendPlotly(facetwrap_lasts)
stippenplot_sizes<-ggplot(bovennul_sorted, aes(x=date, y=points, color=stroke, size=distance, group=AfstandSlag))+
stippenplot_sizes<-ggplot(bovennul, aes(x=date, y=points, color=stroke, size=distance, group=AfstandSlag))+
geom_point() +
scale_color_manual(values=kleurenset_strokes)+
labs(title = "Punten >0 per datum per afstand")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment