Here is one simple example:
plot.new()
tmp <- capture.output(stem(iris$Petal.Length))
text( 0,1, paste(tmp, collapse='
'), adj=c(0,1), family='mono' )
If you want to overlay a histogram then you probably want to use the text
function on each of the elements of tmp
rather than paste
ing. Functions like strheight
and strwidth
will be useful to find the coordinates.
There are also functions in the gplots and plotrix packages for plotting text and adding tables to plots (other functions in other packages probably exist along these lines as well).
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…