Reputation: 1038
I'm getting some label overlap with plot.xts
. For example, see the circled area below:
How do I increase the margins to avoid this? Below is a minimal reproducible example (see the original post for the entire script). I'm most interested in the PNG file that's generated as I'm using this for automation.
library(xts, warn.conflicts=FALSE)
library(xtsExtra, warn.conflicts=FALSE)
timezone = "UTC"
Sys.setenv(TZ=timezone)
sampleData =
"Time (CDT),CPU,Runqueue,Blocked,MemoryFree,PageIns,ContextSwitches,Wait,Steal
2014-10-15 16:12:11,20,0,0,12222172,0,2549,0,0
2014-10-15 16:12:12,27,1,0,12220732,0,3619,0,0
2014-10-15 16:12:13,30,0,0,12220212,0,2316,0,0"
data = as.xts(read.zoo(text=sampleData, format="%Y-%m-%d %H:%M:%S",
header=TRUE, sep=",", tz=timezone))
png("TITLE.png", width=800, height=600)
plot.xts(data, main=paste("TITLE", " (", timezone, ")", sep=""),
minor.ticks=FALSE, yax.loc="left", auto.grid=TRUE, nc=2,
cex.lab=1.3, cex.axis=1.3, cex.main=1.3, cex.sub=1.3)
dev.off()
Upvotes: 1
Views: 268
Reputation: 111
Have you tried plot.zoo(data, nc=2, yax.flip=TRUE)
?
Another point to note is that you appear to be using syntax for an older version of xtsExtra::plot.xts. There have been several changes with xtsExtra::plot.xts since the beginning of July 2014 to improve flexibility and add features as a plotting engine for xts objects.
Upvotes: 2