Would anyone know how to adjust the size of the left margin on a horizontal bar plot so long y-labels can be displayed properly? I have used base R, but if there's an easy fix in ggplot feel free to explain.
I have a data frame called NAV3 with the 55 y-labels that are the names of places (NowPort), and mean_boat_length for my values.
Below is the code with my attempt of adjusting the margins based on a solution from Automatic adjustment of margins in horizontal bar chart. It hasn't worked for my plot though :(
ylabs <- NAV3 %>%
select("NowPort")
linch <- max(strwidth(ylabs, "inch") + 0.4, na.rm = T)
par(mai = c(1.02, linch, 0.82, 0.42))
barplot(height = NAV3$mean_boat_length, names = NAV3$NowPort,
col = "#69b3a2",
horiz = T, las = 1,
xlab = "mean_boat_length")
This is the plot made from the above code This is a sample of my dataframe NAV3