[R] Adding vertical line to histogram and qplot "stacked" plot
Duncan Murdoch
murdoch at stats.uwo.ca
Thu Jan 29 20:26:31 CET 2009
On 1/29/2009 2:03 PM, Jason Rupert wrote:
> R-users it appears I am leaning on your knowledge once again. Is there any way to add a vertical line to a histogram and qplot "stacked" plot? Here is my current attempt:
>
> "qplot" approach attempt:
> qplot(Run, data = data_dataframe, breaks = breaks, fill = Temperature, main = short_title) + scale_x_continuous("Data") + scale_y_continuous("Freq") + scale_fill_discrete("Temperature") + scale_fill_manual(values = c(LOW = "blue", AMB ="black", HIGH = "red")) + geom_abline(v = HighVal, col = "dodgerblue3", lty="dotdash")
>
>
> "hist" approach attempt:
> hist(data_dataframe, breaks = breaks, col = "dodgerblue3", xlab="Data", freq = TRUE, main="") +abline(v = HighVal, col = "dodgerblue3", lty="dotdash")
>
Are you using ggplot2? It uses that notation of adding elements to a
plot. Classic graphics doesn't, so you would just give the different
commands separately on each line, e.g.
hist(data_dataframe, breaks = breaks, col = "dodgerblue3", xlab="Data",
freq = TRUE, main="")
abline(v = HighVal, col = "dodgerblue3", lty="dotdash")
More information about the R-help
mailing list