Reputation: 7846
I created a chart using chart_Series but I want to remove the RHS y axis labels by cropping within R, rather than using an external program
library(quantmod)
getSymbols("SPY", from="2013-01-01", to=Sys.Date())
myTheme <- chart_theme()
myTheme$rylab <- FALSE
chart1 <- chart_Series(SPY,theme=myTheme)
add_TA(SMA(SPY[,4],20),on=1)
But how can I crop the chart to remove the right hand border and also the labels on the rhs y axis?
Thanks for your help.
Upvotes: 0
Views: 141
Reputation: 51680
You can set margins using par
.
par(mar=c(bottom, left, top, right))
The default is
par(mar=c(5,4,4,2)+.1)
Margins are expressed in lines.
See ?par
for more information.
EDIT: it seems I misunderstood the question, but the answer still lies in par
!
par(bty='c')
Will plot a "C" box (i.e. only top, left and bottom).
Other possible values of bty
include:
n
: no box (you can add a customized box using the box
function)
7
: only top and right
l
: only bottom and left
]
: no left border
u
: no top border
If needed you can also pass bty
directly to plot such as:
plot(x, y, bty="n")
Upvotes: 1