library(ggplot2)
library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr     1.1.4     ✔ readr     2.1.4
## ✔ forcats   1.0.0     ✔ stringr   1.5.1
## ✔ lubridate 1.9.3     ✔ tibble    3.2.1
## ✔ purrr     1.0.2     ✔ tidyr     1.3.0
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(ggthemes)
i = file.choose()
os = read.csv(i)
# order_price
os$gr_price[os$order_price < 10000] = "A"
os$gr_price[os$order_price >= 10000 & os$order_price < 20000] = "B"
os$gr_price[os$order_price >= 20000] = "C"
ggplot(data = os, aes(x = order_price, y = delivery_charges, fill = gr_price))+ geom_boxplot() +
  geom_jitter(alpha = 0.5) + theme_bw() + labs(x = "order_price", y = "delivery_charges") +
  theme(axis.title.x = element_text(size = 10, margin = margin(t = 10)), 
        axis.title.y = element_text(size = 10, margin = margin(r = 10)),
        plot.title = element_text(margin = margin(b = 10), face = "bold", hjust = 0.5, size = 12)
  ) + theme(legend.position = "none")

# customer_lat
ggplot(data = os, aes(x = customer_lat, y = delivery_charges))+ geom_boxplot() +
  geom_jitter(alpha = 0.5) + theme_bw() + labs(x = "customer_lat", y = "delivery_charges") +
  theme(axis.title.x = element_text(size = 10, margin = margin(t = 10)), 
        axis.title.y = element_text(size = 10, margin = margin(r = 10)))
## Warning: Continuous x aesthetic
## ℹ did you forget `aes(group = ...)`?

### customer_lat

ggplot(data = os, aes(x = customer_lat, y = delivery_charges))+ geom_boxplot() +
  geom_jitter(alpha = 0.5) + theme_bw() + labs(x = "customer_lat", y = "delivery_charges") +
  theme(axis.title.x = element_text(size = 10, margin = margin(t = 10)), 
        axis.title.y = element_text(size = 10, margin = margin(r = 10)))
## Warning: Continuous x aesthetic
## ℹ did you forget `aes(group = ...)`?

### customer_long

# customer_long
ggplot(data = os, aes(x = customer_long, y = delivery_charges))+ geom_boxplot() +
  geom_jitter(alpha = 0.5) + theme_bw() + labs(x = "customer_long", y = "delivery_charges") +
  theme(axis.title.x = element_text(size = 10, margin = margin(t = 10)), 
        axis.title.y = element_text(size = 10, margin = margin(r = 10)))
## Warning: Continuous x aesthetic
## ℹ did you forget `aes(group = ...)`?

### order_total

os$gr_total[os$order_total < 10000] = "A"
os$gr_total[os$order_total >= 10000 & os$order_total < 20000] = "B"
os$gr_total[os$order_total >= 20000] = "C"

ggplot(data = os, aes(x = order_total, y = delivery_charges, fill = gr_total))+ geom_boxplot() +
  geom_jitter(alpha = 0.5) + theme_bw() + labs(x = "order_total", y = "delivery_charges") +
  theme(axis.title.x = element_text(size = 10, margin = margin(t = 10)), 
        axis.title.y = element_text(size = 10, margin = margin(r = 10)),
        plot.title = element_text(margin = margin(b = 10), face = "bold", hjust = 0.5, size = 12)
  ) + theme(legend.position = "none")

### distance_to_nearest_warehouse

# distance_to_nearest_warehouse
os$gr_dis[os$distance_to_nearest_warehouse < 1] = "A"
os$gr_dis[os$distance_to_nearest_warehouse >= 1 & os$distance_to_nearest_warehouse < 2] = "B"
os$gr_dis[os$distance_to_nearest_warehouse >= 2] = "C"

ggplot(data = os, aes(x = distance_to_nearest_warehouse, y = delivery_charges, fill = gr_dis))+ geom_boxplot() +
  geom_jitter(alpha = 0.5) + theme_bw() + labs(x = "distance_to_nearest_warehouse", y = "delivery_charges") +
  theme(axis.title.x = element_text(size = 10, margin = margin(t = 10)), 
        axis.title.y = element_text(size = 10, margin = margin(r = 10)),
        plot.title = element_text(margin = margin(b = 10), face = "bold", hjust = 0.5, size = 12)
  ) + theme(legend.position = "none")