i'm trying to draw a rectangle on top of a chart series drawn with quantmod
.
> s<-get(getSymbols('phmd'))["2012:"]
> d<-findSupport(s,p=5,threshold=1)
> d
low high cnt std
1 14.79000 14.85292 2 0.04448880
2 13.27222 13.31500 2 0.03024846
3 13.09000 13.15000 2 0.04242641
4 14.12000 14.20583 2 0.06069333
5 12.30222 12.38421 2 0.05797449
6 11.38269 11.43200 2 0.03486580
> chartSeries(s)
> u <- par("usr")
> rect(u[1],d[,'low'],u[2],d[,'high'],col=rgb(1,0,0,alpha=0.5),border=0)
the rectangles being drawn are way off when changing the window size. why is that and how can i overcome this ? please assist, Thanks.
I don't know very well quantmod
. But I think you must add_XXX
functions which add information to the plot object (chob) and re-draw it. see addLines
for example.
That's said, when I use chart_Series
the experimental function, I don't have a problem when I re-size the window.