#reads the different functions in all the libraries
 library(ggplot2)
 library(sf)
## Linking to GEOS 3.11.0, GDAL 3.5.3, PROJ 9.1.0; sf_use_s2() is TRUE
library(ggtext)
 library(plotly)
## 
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
## 
##     last_plot
## The following object is masked from 'package:stats':
## 
##     filter
## The following object is masked from 'package:graphics':
## 
##     layout
 #reads shape file
 br_mun<-read_sf('counties 3')
 #making cuts into smaller parts and adding labeles to the legend
 br_mun$TAAMERIND<-cut(br_mun$TAAMERIND,breaks = c(0,1000,2000,3000,4000,5000,6000,7000),
 labels = c('0-1000','1000-2000','2000-3000','3000-4000','4000-5000','5000-6000','6000-7000'))
Oregon_map<-
#map creation
ggplot()+
  geom_sf(aes(fill=TAAMERIND),data=br_mun)+

  #creates title, subititle and alt text.
  labs(title ="Showing Native American Populations of Oregon's counties",
      subtitle   = "This is a map that shows the population of Native Americans in all of the counties of Oregon", caption = "The source of this is the Oregon Census of 2019.") +
  theme(
  panel.background=element_blank(),
  axis.title.x=element_blank(),
  axis.text.x=element_blank(),
  axis.ticks.x=element_blank(),
  axis.title.y=element_blank(),
  axis.text.y=element_blank(),
  axis.ticks.y=element_blank()
  )
 
# makes map interactive.
ggplotly(Oregon_map,tooltip = "all")