问题
I am using R and I would like to plot a histogram where x-axis
is the number of vehicles and y-axis
is the time interval.
Something like:

回答1:
I guess you need a barplot:
x <- data.frame(n_vehicles = c(10, 20, 30, 40),
time_interval = c(2, 5, 4, 9))
barplot(height = x$time_interval,
names.arg = x$n_vehicles)
Or alternatively:
plot(x = x$n_vehicles,
y = x$time_interval,
type = "h")
The "h"
stands for "histogram".
来源:https://stackoverflow.com/questions/38480183/how-to-plot-histogram-in-r