Skip to content
Prev 246886 / 398506 Next

Lattice, combine histogram and line graph

Thanks Josh, Gabor, and David,

I appreciate your suggestions and the time you took to think about this. 
This was all most helpful. Gabor I will look at the zoo package soon. 
Sounds interesting.

Below is what worked for me from Josh to overlay a line graph on a 
histogram.


obj1 <- xyplot( regular ~ as.Date(gas_data$dates,"%b %d, %Y") , data = 
gas_data,
type = c("g", "h" ) )

obj2 <- xyplot( (gas_data$regular * (cpi_2010 / gas_data$cpi) ) ~ 
as.Date(gas_data$dates,"%b %d, %Y") , data = gas_data,
type = c( "l" ), col = "black" )

obj1 + as.layer(obj2, style = 2, axes = NULL, )


Have a great week,
Jim
Joshua Wiley wrote: