Skip to content

Commit

Permalink
not split by area to plot
Browse files Browse the repository at this point in the history
  • Loading branch information
abennici committed Sep 18, 2020
1 parent 2bf9634 commit 513a333
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions modules/AnimeAnnualCapture.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ AnimCapt <- function(input, output, session,data) {
df<-as.data.frame(data())

df <- df %>%
group_by(year,f_area_type) %>%
#group_by(year,f_area_type) %>%
group_by(year) %>%
summarise(capture = sum(capture))%>%
accumulate_by(~year)%>%
#arrange(desc(f_area_type))%>%
Expand All @@ -39,20 +40,20 @@ AnimCapt <- function(input, output, session,data) {
#color_map <- c(marine="blue", inland="orange")
#df$color <- ifelse(df$f_area_type=="marine", "blue", "orange")

pal <- c("orange", "blue")
pal <- setNames(pal, c("inland", "marine"))
# pal <- c("orange", "blue")
# pal <- setNames(pal, c("inland", "marine"))

fig <- df %>%
plot_ly(
x = ~year,
y = ~capture,
#stackgroup = 'one',
height = 300,
split=~f_area_type,
# split=~f_area_type,
frame = ~frame,
color = ~as.character(f_area_type),
# color = ~as.character(f_area_type),
#colors="Set1",
colors=pal,
# colors=pal,
#color=color_map[df$f_area_type]
#colors = c( "blue", "orange"),
type = 'scatter',
Expand All @@ -64,7 +65,8 @@ AnimCapt <- function(input, output, session,data) {
)

fig <- fig %>% layout(title = "",
yaxis = list(title = "Capture (Tons) by Type of Area", range = c(0,max(df$capture)+25*max(df$capture)/100), zeroline = F),
# yaxis = list(title = "Capture (Tons) by Type of Area", range = c(0,max(df$capture)+25*max(df$capture)/100), zeroline = F),
yaxis = list(title = "Capture (Tons)", range = c(0,max(df$capture)+25*max(df$capture)/100), zeroline = F),
xaxis = list( title = "Year", zeroline = F)
)
fig<- fig %>% animation_opts(frame = 100,transition = 0,redraw = FALSE )
Expand Down

0 comments on commit 513a333

Please sign in to comment.