solution found.
issue: using ggplot in r, creating histograms density curves , add calculated statistics plot can flip through them , compare later on. add mean, standard dev, ks.test(), , few other variables plots, preferably in top right corner. using annotate function how can set x , y position in top right corner?
here code puts text in fixed position, throws off scale of plot.
p <- ggplot(err, aes(x = biztemperrors)) + geom_histogram(aes(y = ..density..)) + geom_density(aes(colour = "kernal"), parse = t) + stat_function(fun = dnorm, args = list(mean(biztemperrors), sd(biztemperrors)), aes(colour="normal")) + annotate("text", x = 500, y = .0011, label = "stats displayed") + ggtitle(label = "title") plot(p)
solution:
d.bte <- density(biztemperrors) #find max density point location annotations maxpointy <- max(d.bte$y) maxpointx <- max(biztemperrors)
Comments
Post a Comment