An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20081202/a636e232/attachment.pl>
question about the tisPlot function in package tis
4 messages · Kyle.Matoba at sf.frb.org, Gabor Grothendieck, Jeffrey J. Hallman
The development version of zoo has a tis to zoo conversion function
that would allow you to plot your data using plot.zoo and xplot.zoo
in which case you can use classic graphics axis function (for plot.zoo)
or lattice facilities (with xyplot.zoo):
source("http://r-forge.r-project.org/plugins/scmsvn/viewcvs.php/*checkout*/pkg/R/as.zoo.tis.R?rev=524&root=zoo")
z <- as.zoo(dat, class = "yearmon")
plot(dat)
xyplot(dat)
There are many examples at ?plot.zoo and ?xyplot.zoo and
in the three zoo vignettes.
On Tue, Dec 2, 2008 at 1:49 PM, <Kyle.Matoba at sf.frb.org> wrote:
List, I am using the 'tisPlot' function in Jeff Hallman's excellent tis package and was hoping that someone could spare me from having to dig into the code of his 'tisPlot' function. So far as I can tell, the preferred method of controlling the plotting of the x-axis is using the 'xTickFreq' and 'xTickSkip' options. Unfortunately, the where the data ends up on the resultant plot is not invariant to this choice, as indicated in the documentation of the 'xTickFreq' option. Has anyone adjusted the frequency of their x-axis label using this package before? I imagine that there must be a better way of doing what I am trying to accomplish, but if not, does anyone have a suggestion on how to work around this without digging into the function itself? ## an example library(tis) strt <- ti(20000101, "monthly") dat <- tis(runif(9*12 - 1), start=strt) # ends in 11/2008 par(mfrow=c(2,1)) tisPlot(dat, xTickFreq="monthly", xTickSkip=6) # graph ends in 11/2008, but looks to start some time in late 1999 tisPlot(dat, xTickFreq="monthly", xTickSkip=12) # graph looks to end around 3/2009 ## end TIA, Kyle
___________________________________________
Research Associate, Macroeconomics
Federal Reserve Bank of San Francisco
[[alternative HTML version deleted]]
______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Sorry that should have been: library(zoo) z <- as.zoo(dat, class = "yearmon") plot(z) xyplot(z) On Tue, Dec 2, 2008 at 2:35 PM, Gabor Grothendieck
<ggrothendieck at gmail.com> wrote:
The development version of zoo has a tis to zoo conversion function
that would allow you to plot your data using plot.zoo and xplot.zoo
in which case you can use classic graphics axis function (for plot.zoo)
or lattice facilities (with xyplot.zoo):
source("http://r-forge.r-project.org/plugins/scmsvn/viewcvs.php/*checkout*/pkg/R/as.zoo.tis.R?rev=524&root=zoo")
z <- as.zoo(dat, class = "yearmon")
plot(dat)
xyplot(dat)
There are many examples at ?plot.zoo and ?xyplot.zoo and
in the three zoo vignettes.
On Tue, Dec 2, 2008 at 1:49 PM, <Kyle.Matoba at sf.frb.org> wrote:
List, I am using the 'tisPlot' function in Jeff Hallman's excellent tis package and was hoping that someone could spare me from having to dig into the code of his 'tisPlot' function. So far as I can tell, the preferred method of controlling the plotting of the x-axis is using the 'xTickFreq' and 'xTickSkip' options. Unfortunately, the where the data ends up on the resultant plot is not invariant to this choice, as indicated in the documentation of the 'xTickFreq' option. Has anyone adjusted the frequency of their x-axis label using this package before? I imagine that there must be a better way of doing what I am trying to accomplish, but if not, does anyone have a suggestion on how to work around this without digging into the function itself? ## an example library(tis) strt <- ti(20000101, "monthly") dat <- tis(runif(9*12 - 1), start=strt) # ends in 11/2008 par(mfrow=c(2,1)) tisPlot(dat, xTickFreq="monthly", xTickSkip=6) # graph ends in 11/2008, but looks to start some time in late 1999 tisPlot(dat, xTickFreq="monthly", xTickSkip=12) # graph looks to end around 3/2009 ## end TIA, Kyle
___________________________________________
Research Associate, Macroeconomics
Federal Reserve Bank of San Francisco
[[alternative HTML version deleted]]
______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Kyle.Matoba at sf.frb.org writes:
List, I am using the 'tisPlot' function in Jeff Hallman's excellent tis package and was hoping that someone could spare me from having to dig into the code of his 'tisPlot' function. So far as I can tell, the preferred method of controlling the plotting of the x-axis is using the 'xTickFreq' and 'xTickSkip' options. Unfortunately, the where the data ends up on the resultant plot is not invariant to this choice, as indicated in the documentation of the 'xTickFreq' option. Has anyone adjusted the frequency of their x-axis label using this package before? I imagine that there must be a better way of doing what I am trying to accomplish, but if not, does anyone have a suggestion on how to work around this without digging into the function itself? ## an example library(tis) strt <- ti(20000101, "monthly") dat <- tis(runif(9*12 - 1), start=strt) # ends in 11/2008 par(mfrow=c(2,1)) tisPlot(dat, xTickFreq="monthly", xTickSkip=6) # graph ends in 11/2008, but looks to start some time in late 1999 tisPlot(dat, xTickFreq="monthly", xTickSkip=12) # graph looks to end around 3/2009
Try this: tisPlot(dat, xTickFreq = "annual", xMinorTickFreq = "monthly") I don't understand what you mean by "where the data ends up on the
resultant plot is not invariant to this choice, as indicated in the documentation of the 'xTickFreq' option." The documentation for xTickFreq says:
xTickFreq: a string like the ones returned by 'tifName'. This argument
and 'xTickSkip' jointly specify locations for labeled x axis
ticks as follow: (i) find the 'ti''s of the given frequency
that correspond to 'xAxisMin' and 'xAxisMax', then (ii)
including those as endpoints, generate a sequence of every
'xTickSkip''th 'ti' between them.
Two special strings can also be given. "none" means no
labelled tick marks, while "auto" tries (not always
successfully) to come up with reasonable tick locations
automatically. "auto" also overrides any 'xTickSkip'
setting.
The default is "auto".
which does not indicate that your data points are moved. At any rate, please
try my suggestion above, which gives a pretty nice axis for your time range.
Jeff