[R-SIG-Finance] Modify the chart object to save plotted text

Stergios Marinopoulos stergios_marinopoulos at yahoo.com
Wed Apr 11 18:31:15 CEST 2012


[I originally posed this question under a different thread regarding ablines, but I imagine the question was different enough that it went ignored, so I will try again using a new thread.]


How can I alter the underlying chart object so that text annotations are not lost when the plot is re-drawn, like for example when a call to addTA is made?  (I am using the experimental versions of the charting api in quantmod)

Here's how I currently add text to a chart:

getSymbols("SPY", from="2012-01-01", to="2012-04-01")
chart_Series(SPY)
x <- SPY["2012-02-15", which.i=TRUE]
text(x, Lo(SPY)[x,], "2012-02-15", srt=90, adj=c(1,0.5) )


And now when I add this TA the text disappears:

add_TA(Cl(SPY)<134,border=NA,col='#888888',on=-1)

I think this probably requires going under the hood in the library, so a pointer on where to begin looking would be greatly appreciated.

Thanks,

sm
--
Stergios Marinopoulos



More information about the R-SIG-Finance mailing list