# Load required libraries
library(sf)
## Linking to GEOS 3.13.1, GDAL 3.11.4, PROJ 9.7.0; sf_use_s2() is TRUE
library(tmap)
# Read the shapefile
rivers <- st_read("C:/Users/IT/Downloads/bgd_watcrsa_1m_iscgm/bgd_watcrsa_1m_iscgm.shp")
## Reading layer `bgd_watcrsa_1m_iscgm' from data source 
##   `C:\Users\IT\Downloads\bgd_watcrsa_1m_iscgm\bgd_watcrsa_1m_iscgm.shp' 
##   using driver `ESRI Shapefile'
## Simple feature collection with 60 features and 13 fields
## Geometry type: POLYGON
## Dimension:     XYZ
## Bounding box:  xmin: 88.0122 ymin: 20.77948 xmax: 92.3792 ymax: 26.24221
## z_range:       zmin: 0 zmax: 0
## Geodetic CRS:  WGS 84
tmap_mode("plot")  # for static plots
## ℹ tmap modes "plot" - "view"
## ℹ toggle with `tmap::ttm()`
## This message is displayed once per session.
tm_shape(rivers) +
  tm_lines(col = "blue") 

tmap_mode("view")  # for interactive view
## ℹ tmap modes "plot" - "view"
tm_shape(rivers) +
  tm_lines(col = "blue") +
  tm_layout(title = "Bangladesh Rivers", frame = FALSE)
## [v3->v4] `tm_layout()`: use `tm_title()` instead of `tm_layout(title = )`
library(tmap)
tm_shape(World)+ 
  tm_polygons(
    fill = "#0000FF", # fill color
    col = "black",    # line color
    lwd = 1.5,        # line width
    lty = "dashed")   # line type
library(ggthemes)
tm_shape(World)+ tm_polygons(
  fill = "HPI",
  fill.scale = tm_scale_intervals(
    style = "fisher",      # a method to specify the classes
    n = 7,                 # number of classes
    midpoint = 38,         # data value mapped to the middle palette color
    values = "pu_gn_div"   # color palette; 
                           # run cols4all::c4a_gui() to explore color palettes
  ))
tm_shape(metro) +
  tm_bubbles(size = "pop2020") +
  tm_basemap("CartoDB.Voyager")
tm_shape(World) + 
  tm_polygons(
    fill = "economy",
    fill.chart = tm_chart_bar())
## [view mode] Map component `tm_chart_bar()` not supported in "view" mode.
## This message is displayed once per session.