Reputation: 21
I have been successful in making the Histogram for the variable wind speed for all years and months in my data set. But I want the the x-axis labeled at 1 mile/hr intervals.Each bin is also of 1 mile/hr interval. Currently by default the x axis is labeled at 20 miles/hour intervals.
Here is my R code.
histogram(~ as.numeric(spd) | factor(month) + factor(year), data = spd_sub,
xlab = "spd in miles/hour",
nint= max(as.numeric(spd))-min(as.numeric(spd)), layout = c(1, 1))
Any idea how to do this?
Upvotes: 2
Views: 7409
Reputation: 70653
Maybe this could be little something to think about. Notice the use of scales
.
library(lattice)
Depth <- equal.count(quakes$depth, number=8, overlap=.1)
xyplot(lat ~ long | Depth, data = quakes)
This gives you the following graph.
And if you set the scales argument:
xyplot(lat ~ long | Depth, data = quakes,
scales = list(y = list(at = seq(from = 0, to = -50, by = -10))))
One gratis with a histogram (changed the tick marks and rotated them):
histogram( ~ height | voice.part, data = singer,
xlab = "Height (inches)", type = "density",
panel = function(x, ...) {
panel.histogram(x, ...)
panel.mathdensity(dmath = dnorm, col = "black",
args = list(mean=mean(x),sd=sd(x)))
},
scales = list(x = list(at = seq(60, 80, by = 2), rot = 45)))
Upvotes: 5