cspy <- chart_Series(SPY )
cspy$Env$actions[[3]]
#------------------
expression(axt <- axTicksByTime(xdata[xsubset], format.labels = format.labels),
axis(1, at = axt, labels = names(axt), las = 1, lwd.ticks = 1,
mgp = c(3, 1.5, 0), tcl = -0.4, cex.axis = 0.9))
attr(,"frame")
[1] 1
attr(,"clip")
[1] TRUE
attr(,"env")
<environment: 0x11cddc148>
You need to save the attributes so they can be put back in and you need to change the format.labels to your new specifications and then use the names from the axt vector rather than their value. The las
parameter is the rotation indicator for base graphics. See ?par
:
attrs <- attributes(cspy$Env$actions[[3]])
cspy$Env$actions[[3]] <-
expression(axt <- axTicksByTime(xdata[xsubset], format.labels = "%b %d"),
axis(1, at = axt, labels = names(axt), las = 2, lwd.ticks = 1,
mgp = c(3, 1.5, 0), tcl = -0.4, cex.axis = 0.9))
attributes(cspy$Env$actions[[3]]) <- attrs
cspy