Override y scale and x scale with xlim / ylim or xrange / yrange in quantmod :: chart_Series () - is it impossible?

I am trying to build some support / resistance lines on top of a quantum: chart_Series (). The problem is that interesting support / resistance lines are outside the range of the series data (lower or higher) up to the current time (I would also like to slightly expand the chart to the right of the last time stamp).

Looking at the source code quantmod :: chart_Series () I don’t see a way to specify ylim / xlim or, what was possible in the old days with quantmod :: chartSeries, using yrange to override y-scale. The comment here https://r-forge.r-project.org/scm/viewvc.php?view=rev&root=quantmod&revision=520 also confirms my hunch ...

Is my diagnosis correct or maybe there is a way that allows me to redefine the y-scale in quantmod :: chart_Series? Any idea how to do what I want is really appreciated.

Thank.

Best, Samo

+5
source share
1 answer

chart_Series() - ! - , .

, (?), , - , chart_Series() (.. / "replot", , ).

## Create an example plot
getSymbols("YHOO")
myChob <- chart_Series(YHOO)

## Plot it, with its default xlim and ylim settings
myChob


## Get current xlim and ylim settings for `myChob` (chob = chart object)
myxlim <- myChob$get_xlim()
myylim <- myChob$get_ylim()

## Alter those limits
myxlim <- c(1, 2000)
myylim[[2]] <- structure(c(0, 50), fixed=TRUE)

## Use the setter functions in the myChob environment to set the new limits.
## (Try `myChob$set_ylim` and `ls(myChob$Env)` to see how/where these are set.)
myChob$set_ylim(myylim)
myChob$set_xlim(myxlim)

## Plot the revised graph
myChob
+5

All Articles