adam.888
adam.888

Reputation: 7846

R quantmod chart_Series: switching off the RHS y axis label for add_TA(as indicators close together overwrite scale)

I am trying to switch off the right hand side y axis label. The reason I am trying to do this is that if you have a few indicators close together then the RHS scale gets overwritten.

I can do this by altering myTheme

library(quantmod)
getSymbols("SPY", from="2013-01-01", to=Sys.Date())


myTheme <- chart_theme()
myTheme$rylab <- FALSE

chart_Series(SPY,theme=myTheme)

But when I add an indicator it reappears again

add_TA(SMA(SPY[,4],20),on=1,col="black",lty=2, lwd = 1,legend = NULL)

How can I switch the RHS y axis for indicators? Also how can I make the y axis on the LHS have larger fonts?

I would be grateful for your help.

Upvotes: 0

Views: 581

Answers (1)

IRTFM
IRTFM

Reputation: 263352

[Edited] You repeat the application of theme=myTheme after add_TA(...)

myPars <-chart_pars(); myPars$cex<-1.5
cspy <- chart_Series(SPY,theme=myTheme, pars=myPars)
cspy <- add_TA(SMA(SPY[,4],20),on=1,col="black",lty=2, lwd = 1,legend = NULL)
cspy
cspy<- chart_Series(SPY,theme=myTheme, pars=myPars)
cspy

Note that you will need to use again the margin widening strategy I showed you yesterday because the default margins are insufficient on the LHS.

Upvotes: 2

Related Questions