Displaying 1 result from an estimated 1 matches for "theboxplot".
2013 Jul 25
1
GGplot 2 – cannot get histogram and box plot axis to match.
...aSet <- Cars93
#variables to calculate the range to extend the axis
dataVector <- unlist(dataSet[,"MPG.city"])
dataRange <- max(dataVector) - min(dataVector)
graphRange <- c(min(dataVector) - dataRange/5,
max(dataVector) + dataRange/5)
#making the box plot
theBoxPlot <- ggplot(dataSet,aes_string(x = "MPG.city",y = "MPG.city"))
theBoxPlot = theBoxPlot + geom_boxplot() + expand_limits(y= graphRange) + coord_flip()
print(theBoxPlot)
#making the histogram
thePlot <- ggplot(dataSet,aes_string(x = "MPG.city"))
thePlot <-theP...