I am drawing a density histogram, and want to label the plots with the mean using ltext(). But I need the x,y coordinates to feed into ltext, and I can't calculate them easily from my data. Is there a way to get the x and y ranges being used for the plot, so I can put the text at the correct position in the panel.function? Thanks, Jim Rome
On 2010-04-01 9:53, James Rome wrote:> I am drawing a density histogram, and want to label the plots with the > mean using ltext(). But I need the x,y coordinates to feed into ltext, > and I can't calculate them easily from my data. Is there a way to get > the x and y ranges being used for the plot, so I can put the text at the > correct position in the panel.function? >You probably want current.panel.limits(). -Peter Ehlers> Thanks, > Jim Rome > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > >-- Peter Ehlers University of Calgary
On Apr 1, 2010, at 11:53 AM, James Rome wrote:> I am drawing a density histogram, and want to label the plots with the > mean using ltext(). But I need the x,y coordinates to feed into ltext, > and I can't calculate them easily from my data. Is there a way to get > the x and y ranges being used for the plot, so I can put the text at > the > correct position in the panel.function?No code .... so what a "density histogram" might be is still vague, but perhaps you are using density() and if so, have you looked at the "Value" section of that function's help page? (The same advice would apply were you using one of the (several) histogram functions. -- David.