Page 1

Number of Bills Passed Since 2001

cel %>% 
  drop_na() %>% 
  filter(year > 19) %>% 
  group_by(year, Party) %>% 
  summarise(passed = sum(all_pass, na.rm = TRUE), .groups = 'drop') %>% 
  ggplot(aes(x = factor(year), y = passed, fill = Party)) +
  geom_bar(stat = "identity") +
  labs(title = "Number of Bills Passed Since 2000", x = "Year", y = "All Bills Passed") +
  scale_fill_manual(values = c("yellow", "green"))

Page 2

Column

Gender and Votepct since 2000

year_vot_gen <- cel %>% 
  select(votepct, year, Gender) %>% 
  filter(year > 1999)

 ggplot(year_vot_gen, aes(x = year, y = votepct, color = Gender)) +
  geom_point()+
  labs(title = "Gender and Votepct since 2000", x = "year", y = "votepct") +
  scale_color_manual(values = c("yellow", "green"))

Column

Passage and votepct in 2011

(cel%>%
  drop_na()%>%
  filter(year==2011) %>%
    ggplot(
      aes(x=votepct,y=all_pass,color=Gender)) +
      geom_point() +
      labs(title="Passage and votepct in 2011",x="votepct",y="All Pass") +
      scale_color_manual(values=c("yellow","green")) +
      geom_smooth(method=lm)) %>%
  ggplotly()
## `geom_smooth()` using formula = 'y ~ x'

Page 3

Column

The relationship between voting percentages and passage rates for each year from 2001 to 2009

year_vot_pass_2009 <- cel %>% 
  select(votepct, year, all_pass) %>% 
  filter(year > 1999 & year<2011)

library(plotly)

ggplotly(ggplot(year_vot_pass_2009,aes(x=all_pass,y=votepct,frame=year))+geom_point()+geom_segment(aes(x=all_pass,xend=all_pass,y=0,yend=votepct)))

Page 4

Column

Passage and votepct in 2009 by Party

filtered_data <- cel %>%
  drop_na() %>%
  filter(year == 2009)

ggplot(filtered_data, aes(x = votepct, y = all_pass, fill = Party)) +
  geom_histogram(stat = "identity") +
  facet_wrap(~ Party) +
  labs(
    title = "Passage and votepct in 2009 by Party",
    x = "Votepct",
    y = "All Pass"
  ) +
  scale_fill_manual(values = c("yellow", "green"))
## Warning in geom_histogram(stat = "identity"): Ignoring unknown parameters:
## `binwidth`, `bins`, and `pad`

Page 5

Column

Votepct by Party in 1987 【Box Plot】

cel_1987 <- cel %>% 
  filter(year == 1987)

ggplot(cel_1987, aes(x = Party, y = votepct, color = Party)) +
  geom_boxplot() +
  labs(title = "Votepct by Party in 1987 【Box Plot】", x = "Party", y = "Votepct") +
  scale_color_manual(values = c("yellow", "green"))

Page 6

Column

“Scatter Plot and Density Plot Matrix of Voting Percentage and Passage Status”

vot_pass <- cel %>%
  select(votepct, all_pass) 
library(tidyverse)
library(GGally)
## Registered S3 method overwritten by 'GGally':
##   method from   
##   +.gg   ggplot2
library(ggcorrplot)
library(ggthemes)
library(ggalt)
## Registered S3 methods overwritten by 'ggalt':
##   method                  from   
##   grid.draw.absoluteGrob  ggplot2
##   grobHeight.absoluteGrob ggplot2
##   grobWidth.absoluteGrob  ggplot2
##   grobX.absoluteGrob      ggplot2
##   grobY.absoluteGrob      ggplot2
my_scatter <- function(data,mapping){ggplot(data=data,mapping=mapping)+geom_jitter(color="yellow")}
my_density <- function(data,mapping){ggplot(data=data,mapping=mapping)+geom_density(alpha=1,fill="green")}
ggpairs(vot_pass,lower=list(continuous=my_scatter),diag=list(continuous=my_density))

Page 7

Column

Comparison of Bills Introduced and Bills with Committee Action by Members from Different Parties

bill_aic <- cel %>%
  select(all_bills, all_aic,Party) 
ggplot(bill_aic, aes(x = all_bills, y = all_aic, color = Party)) +
  geom_line() +
  labs(
    x = "Number of Bills Introduced",
    y = "Number of Bills with Committee Action"
  )