Re: [R] plot zoo custom panel help

From: Gabor Grothendieck <ggrothendieck_at_gmail.com>
Date: Fri, 25 Jul 2008 15:34:25 -0400

Please clarify what the problem is. If its the lack of content in the plot that was already addressed. You mention ylim but its not clear what your comment refers to since the plot command does not use ylim.

Also make sure you are using the latest version of zoo and identify the version in your posts and, in general, read the last line of every message to r-help and read the posting guide. Also, it would be appreciated if you follow up on past advice in the thread prior to reposting.

On Fri, Jul 25, 2008 at 1:37 PM, stephen sefick <ssefick_at_gmail.com> wrote:
>
> I am still having the can't draw a plot without putting in a ylim value when
> trying to draw a plot. I have included reproducible code sorry for the
> previous post
>
>>
>> #the below code is the way that I would like the plot to look. I have
>> tried
>> to write a panel function:
>> my.panel <- function(x, y, ..., pf = parent.frame()) {
>> axis(side=1, at = seq(rng[1], rng[2], 1/12), labels = n, tcl = -0.3)
>> }
>> #but it does not work and I am at a loss and help would be appreciated.
>> I
>> will use this for multiple
>>
>> library(zoo)
>> library(chron)
>>
>> #this is what I would like the plot to look like
>> f <- structure(c("12", "16", "16", "17", "19", "14", "15", "14", "14",
>> "13", "15", "14", "13", "13", "13", "13", "13", "14", "15", "16",
>> "15", "14", "13"), .Names = c("3", "6", "8", "10", "12", "14",
>> "16", "18", "20", "22", "1", "4", "5", "7", "9", "11", "13",
>> "15", "17", "19", "21", "23", "2"), index =
>> structure(c(2006.08333333333,
>> 2006.25, 2006.33333333333, 2006.41666666667, 2006.5, 2006.58333333333,
>> 2006.66666666667, 2006.75, 2006.83333333333, 2006.91666666667,
>> 2007, 2007.08333333333, 2007.16666666667, 2007.25, 2007.33333333333,
>> 2007.41666666667, 2007.5, 2007.58333333333, 2007.66666666667,
>> 2007.75, 2007.83333333333, 2007.91666666667, 2008), class = "yearmon"),
>> class = "zoo")
>>
>> n <-
>>
>> c("f","m","a","m","j","j","a","s","o","n","d","j","f","m","a","m","j","j","a","s","o","n","d","j")
>>
>> rng <- range(time(f))
>> plot(f, xaxt="n", ylim=c(0,20))
>> axis(side=1, at = seq(rng[1], rng[2], 1/12), labels = n, tcl = -0.3)
>>
>>
>>
>>
>> #this is data for a multiple plot. I would like this to look like the
>> # above, and I have tried the examples but i just can't figure out panel
>> #writing
>> d <- structure(c("12", "16", "16", "17", "19", "14", "15", "14", "14",
>> "13", "15", "14", "13", "13", "13", "13", "13", "14", "15", "16",
>> "15", "14", "13", "3.0", "2.6", "2.5", "2.4", "2.5", "2.3", "2.5",
>> "3.0", "2.6", "2.6", "2.6", "2.9", "2.8", "2.7", "3.0", "2.8",
>> "2.7", "2.7", "2.7", "2.7", "2.8", "2.7", "2.7"), .Dim = c(23L,
>> 2L), .Dimnames = list(c("3", "6", "8", "10", "12", "14", "16",
>> "18", "20", "22", "1", "4", "5", "7", "9", "11", "13", "15",
>> "17", "19", "21", "23", "2"), c("Alkalinity", "Chloride")), index =
>> structure(c(2006.08333333333,
>> 2006.25, 2006.33333333333, 2006.41666666667, 2006.5, 2006.58333333333,
>> 2006.66666666667, 2006.75, 2006.83333333333, 2006.91666666667,
>> 2007, 2007.08333333333, 2007.16666666667, 2007.25, 2007.33333333333,
>> 2007.41666666667, 2007.5, 2007.58333333333, 2007.66666666667,
>> 2007.75, 2007.83333333333, 2007.91666666667, 2008), class = "yearmon"),
>> class = "zoo")
>>
>> my.panel <- function(x, y, ..., pf = parent.frame()) {
>> axis(side=1, at = seq(rng[1], rng[2], 1/12), labels = n, tcl = -0.3)
>> }
>>
>> plot(d, panel=my.panel ,xaxt="n")
>>
>>
>> --
>> > Let's not spend our time and resources thinking about things that are so
>> > little or so large that all they really do for us is puff us up and make
>> > us
>> > feel like gods. We are mammals, and have not exhausted the annoying
>> > little
>> > problems of being mammals.
>> >
>> > -K. Mullis
>> >
>> > [[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.
>> >
>
>
>
> --
> Let's not spend our time and resources thinking about things that are so
> little or so large that all they really do for us is puff us up and make us
> feel like gods. We are mammals, and have not exhausted the annoying little
> problems of being mammals.
>
> -K. Mullis



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. Received on Fri 25 Jul 2008 - 19:39:17 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 25 Jul 2008 - 21:32:59 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive