library(ggplot2)

Data <- read.table(file.choose(),header = T)
Data$Banjir <- as.numeric(Data$Banjir)
ggplot(Data,aes(x = Provinsi, y = Banjir)) +
  geom_col(
    fill = "skyblue",
    color = "black",
    width = 0.85
  ) +
  geom_text(
    aes(label = Banjir),
    vjust = -0.4,
    size = 2.5
  ) +
  scale_y_continuous(
    breaks = seq(0, 1200, by = 200),
    expand = expansion(mult = c(0, 0.08))
  ) +
  labs(
    title = "Jumlah Desa/Kelurahan yang Mengalami Banjir",
    subtitle = "Menurut Provinsi di Indonesia Tahun 2025",
    x = "Provinsi",
    y = "Jumlah Desa/Kelurahan"
  ) +
  theme_classic() +
  theme(
    axis.text.x = element_text(
      angle = 45,
      hjust = 1,
      vjust = 1,
      size = 7
    ),
    axis.title.x = element_text(
      margin = margin(t = 2),
      size = 10
    ),
    axis.text.y = element_text(size = 8),
    plot.title = element_text(
      hjust = 0.5,
      face = "bold",
      size = 14
    ),
    plot.subtitle = element_text(
      hjust = 0.5,
      size = 11
    ),
    legend.position = "none"
  )

library(ggplot2)

Data <- read.table(file.choose(), header = TRUE)
Data$Banjir <- as.numeric(Data$Banjir)

Data_urut <- Data[order(Data$Banjir, decreasing = TRUE), ]
Data_urut$Provinsi <- factor(
  Data_urut$Provinsi,
  levels = Data_urut$Provinsi)

ggplot(Data_urut, aes(x = Banjir, y = Provinsi)) +
  geom_col(
    fill = "pink",
    color = "black",
    width = 0.70
  ) +
  geom_text(
    aes(label = Banjir),
    hjust = -0.2,
    size = 1.9
  ) +
  scale_x_continuous(
    breaks = seq(0, 1200, by = 200),
    expand = expansion(mult = c(0, 0.08))
  ) +
  labs(
    title = "Jumlah Desa/Kelurahan yang Mengalami Banjir",
    subtitle = "Menurut Provinsi di Indonesia Tahun 2025",
    x = "Jumlah Desa/Kelurahan",
    y = "Provinsi"
  ) +
  theme_classic() +
  theme(
    axis.text.y = element_text(size = 6),
    axis.text.x = element_text(size = 7),
    plot.title = element_text(
      hjust = 0.5,
      face = "bold",
      size = 14
    ),
    plot.subtitle = element_text(
      hjust = 0.5,
      size = 11
    )
  )

library(ggplot2)

Data <- read.table(file.choose(), header = T)

ggplot(Data, aes(x = Banjir)) +
  geom_histogram(
    binwidth = 100,
    boundary = 0,
    fill = "yellow",
    color = "black"
  ) +
  scale_x_continuous(
    breaks = seq(0, 1100, by = 100),
    limits = c(0, 1100)
  ) +
  labs(
    title = "Jumlah Desa/Kelurahan yang Mengalami Banjir",
    x = "Jumlah Desa/Kelurahan",
    y = "Freq"
  ) +
  theme_classic() +
  theme(
    axis.text.x = element_text(
      angle = 0,
      hjust = 0.5
    ),
    plot.title = element_text(
      hjust = 0.5,
      face = "bold"
    )
  )

library(ggplot2)

Data <- read.table(file.choose(), header = T)

ggplot(Data, aes(x = "", y = Banjir)) +
  geom_boxplot(fill = "purple") +
  labs(
    title = "Box Plot Jumlah Desa/Kelurahan yang Mengalami Banjir",
    x = "",
    y = "Jumlah Desa/Kelurahan"
  ) +
  theme_minimal() +
  theme(
    plot.title = element_text(
      hjust = 0.5,
      face = "bold"
    )
  )

library(ggplot2)
Data_Kalimantan <- read.table(file.choose(),header = T)

Data_Kalimantan$Provinsi <- factor(Data_Kalimantan$Provinsi,
  levels = unique(Data_Kalimantan$Provinsi)
)

ggplot(
  Data_Kalimantan,
  aes(x = Provinsi, y = Banjir)
) +
  geom_col(
    aes(fill = Provinsi),
    color = "black",
    width = 0.85
  ) +
  scale_fill_manual(
    values = c(
      "pink",
      "purple",
      "skyblue",
      "yellow",
      "seagreen"
    )
  ) +
  geom_text(
    aes(label = Banjir),
    vjust = -0.4,
    size = 3
  ) +
  scale_y_continuous(
    breaks = seq(0, 1000, by = 200),
    expand = expansion(mult = c(0, 0.08))
  ) +
  labs(
    title = "Jumlah Desa/Kelurahan yang Mengalami Banjir",
    subtitle = "Provinsi di Pulau Kalimantan Tahun 2025",
    x = "Provinsi",
    y = "Jumlah Desa/Kelurahan"
  ) +
  theme_classic() +
  theme(
    axis.text.x = element_text(
      angle = 45,
      hjust = 1,
      vjust = 1,
      size = 8
    ),
    axis.title.x = element_text(
      margin = margin(t = 5)
    ),
    axis.text.y = element_text(size = 8),
    plot.title = element_text(
      hjust = 0.5,
      face = "bold"
    ),
    plot.subtitle = element_text(
      hjust = 0.5
    ),
    legend.position = "none"
  )