-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAllGraphics.R
More file actions
85 lines (64 loc) · 3.71 KB
/
AllGraphics.R
File metadata and controls
85 lines (64 loc) · 3.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
theme_update(plot.title = element_text(hjust = 0.5))
##Bargraph for AIG Participation
## To do change the space between the columns
ParticipationPre = PolicyLevelTermsCompDF$`AIG Participation %_Pre`
ParticipationPost = PolicyLevelTermsCompDF$`AIG Participation %_Post`
AIGParticipationPlotExp = ggplot() +
geom_col(mapping = aes(x = factor(c("Pre","Post"),levels = c("Pre","Post")),
y = c(ParticipationPre,ParticipationPost),
fill = factor(c("Pre","Post"),levels = c("Pre","Post"))),
width = 0.25,position = position_dodge(width = 2)
)+
guides(fill = FALSE)+
geom_text(label = c(ParticipationPre,ParticipationPost) )+
labs( x = "",y = "Participation %" ,title = "AIG Participation")
AIGParticipationPlot_Out = renderPlot({AIGParticipationPlotExp})
#### Bar graph for Limits
## to do display value at the Bar top
LimitPre = PolicyLevelTermsCompDF$Limit_Pre
LimitPost = PolicyLevelTermsCompDF$Limit_Post
PolicyLimitPlotExp = ggplot() +
geom_col(mapping = aes(x = factor(c("Pre","Post"),levels = c("Pre","Post")),
y = c(LimitPre,LimitPost),
fill = factor(c("Pre","Post"),levels = c("Pre","Post"))),
width = 0.25,position = position_dodge(width = 0.01)
)+
guides(fill = FALSE)+
geom_text(label = c(LimitPost,LimitPost))+
labs( x = "",y = paste0("Limit in ", AccountDetailsPreDF$X__1[12]) ,title = "Limit")
PolicyLimitPlot_Out = renderPlot(PolicyLimitPlotExp)
######Bar graph for TCP
# TCPCompDFForGraph = rbind(cbind(PrePost = "Pre",TCPPreDF),
# cbind(PrePost = "Post",TCPPostDF))
#
# TCPCompDFForGraph = TCPCompDFForGraph %>%
# mutate(`Layer Name` = as.factor(`Layer Name`))
#
# for(i in colnames(TCPCompDFForGraph)){
# if(i %in% c("EQ TCP","FL TCP","WS TCP")){
# TCPCompDFForGraph[,i] = as.numeric(TCPCompDFForGraph[,i])
# tempGraph = ggplot()+
# assign(paste0(i,"Graph"),)
# }
# }
#
# TCPCompDFForGraph = gather(TCPCompDFForGraph,c(`EQ TCP`,`FL TCP`,`WS TCP`),
# key = "Peril",value = "TCP",factor_key = TRUE)
#
# ggplot(data = TCPCompDFForGraph) +
#
# class(TCPCompDFForGraph$`EQ TCP`)
####### Bar Graph for Locations
NoOfLocationsPlotExp = ggplot() +
geom_col(mapping = aes(x = factor(c("Pre","Post"),levels = c("Pre","Post")),
y = c(nrow(LocationDetailsPreDF),nrow(LocationDetailsPostDF)),
fill = factor(c("Pre","Post"),levels = c("Pre","Post"))),
width = 0.25,position = position_dodge(width = 0.01)
)+
guides(fill = FALSE)+
geom_text(aes( x = factor(c("Pre","Post"),levels = c("Pre","Post")),
y = c(nrow(LocationDetailsPreDF),nrow(LocationDetailsPostDF)),
label = c(nrow(LocationDetailsPreDF),nrow(LocationDetailsPostDF))),
nudge_y = 15)+
labs( x = "",y = "Location Count" ,title = "No of Locations")
NoOfLocationsPlot_Out = renderPlot(NoOfLocationsPlotExp)