library(ggplot2) # Data Source: https://www.kaggle.com/datasets/samuelotiattakorah/agriculture-crop-yield?resource=download df <- read.csv("crop_yield.csv", header = TRUE, sep = ",") df <- df[df$Crop == "Soybean", ] # Single Boxplot ggplot(df, aes(x = "", y = Yield_tons_per_hectare)) + geom_boxplot(fill = "#D44803", width = 0.3) + # make box narrower labs(y = "Yield", x = NULL, title = "Boxplots with PikBioStat: Soyabean Yield") + theme_minimal(base_size = 14) + theme( panel.grid = element_blank(), # remove gridlines axis.text.x = element_blank(), # hide x-axis labels axis.ticks.x = element_blank(), # hide x-axis ticks axis.text.y = element_text(size = 14), # bigger y-axis labels plot.title = element_text(hjust = 0.5) # center title ) # Group Comparisons ggplot(df, aes(x = Fertilizer_Used, y = Yield_tons_per_hectare)) + geom_boxplot(fill = "#D44803", width = 0.5) + # multiple boxes by Soil_Type labs(y = "Yield (tons/ha)", x = "Fertilizer Used", title = "Boxplots with PikBioStat: Soybean Yield by Fertilizer Used") + theme_minimal(base_size = 14) + theme( panel.grid = element_blank(), axis.text.x = element_text(size = 12, angle = 45, hjust = 1), # readable labels axis.text.y = element_text(size = 14), axis.title.x = element_text(size = 14, face = "bold"), axis.title.y = element_text(size = 14, face = "bold"), plot.title = element_text(hjust = 0.5, size = 16, face = "bold") )