For the following barplot
in R:
bp <- barplot(df$share.work,
names.arg=df
space = c(0, diff(df$dist.km.work)),
col="blue",
xlab="Kilometer",
ylab="Trip Frequency",
ylim=c(0,.25), las=1 )
Q1: How can I add an x-axis without increasing the bars' width?
Q2: How can I make the title of the y-axis horizontal?
data:
df<- structure(list(year = c(2016L, 2016L, 2016L, 2016L, 2016L, 2016L
), km = structure(1:6, .Label = c("km1", "km3", "km5", "km7",
"km9", "km15", "km20", "km25", "km30", "km35", "km42.5"), class = "factor"),
dist.km.work = c(0.5, 2, 4, 6, 8.5, 12.5), trips.work = c(14725L,
46730L, 58500L, 59710L, 87060L, 117535L), total.trips.work = c(476835L,
476835L, 476835L, 476835L, 476835L, 476835L), share.work = c(0.0308,
0.098, 0.12, 0.125,
0.18, 0.246)), row.names = c(NA,
-6L), class = c("tbl_df", "tbl", "data.frame"))