Sarah,
Thank you very much. I apoligize for the way the code came through. I'm not
sure whay it was formatted that way.
You were 100% correct about the lend=2. Thank you. I don't know why i didn't
think to look at par. I was thinking the argument had to be from segments. It
even says "... further graphical parameters (from par)" right in the help page
for ?segments. I apoligize for this oversight and appreciate your response
anyway.
Tyler Rinker
> Date: Wed, 19 Oct 2011 17:34:27 -0400
> Subject: Re: [R] Square ended segments
> From: sarah.gos...@gmail.com
> To: tyler_rin...@hotmail.com
> CC: r-help@r-project.org
>
> Hi Tyler,
>
> Your code is unreadable, but take a look at ?par and search for lend.
>
> ?par is the first place to look for all base graphics settings.
>
> Sarah
>
> On Wed, Oct 19, 2011 at 5:26 PM, Tyler Rinker <tyler_rin...@hotmail.com>
> wrote:
> >
> > Good Afternoon R Community,
> > I am working on plotting behavior codes over short durations of time (a
> > few seconds at a time over 1-2 hrs). I am utilizing as.POSIXct to store
> > the time. I wanted to make a quasi time line using these time. I utilized
> > the segments function to represent these times. However the segments
> > rounds off at the ends and does not have the crisp look I need for my
> > purposes. I then used a "squared" point(pch=15)at the beginning and end of
> > each of these segments to make it square. It looks like I want it to now
> > but the point is centered over the ends of the segments meaning the
> > segments get extended a bit in each direction. This distorts a segment
> > that is only a few seconds long.
> > How can I make nice squared end segments roughly lwd=6 and be accurate
> > with the segment's begining and end point.
> >
> > I've included the code in this email and in a pastebin link:Link to the
> > pastebin code: http://pastebin.com/raw.php?i=LYnZh1VD OS: win 7 R ver:
> > 2.14 build XX<-structure(list(ID = structure(1:7, .Label = c("a", "b",
> > "c", "d", "e", "f", "g"), class = "factor"), X1 = structure(1:7, .Label =
> > c("A", "B", "C", "D", "E", "F", "G"), class = "factor"), Code.begin =
> > structure(c(1318996823, 1318997163, NA, 1318997842, NA, 1319000172,
> > 1319001123), class = c("POSIXct", "POSIXt"), tzone = ""), Code.end =
> > structure(c(1318996828, 1318997168, NA, 1318997884, NA, 1319000229,
> > 1319001142), class = c("POSIXct", "POSIXt"), tzone = ""), Code2.begin =
> > structure(c(1318996823, 1318997163, NA, 1318997842, 1318997962, NA,
> > 1319001123), class = c("POSIXct", "POSIXt"), tzone = ""), Code2.end =
> > structure(c(1318996828, 1318997168, NA, 1318997884, 1318998120, NA,
> > 1319001142), class = c("POSIXct", "POSIXt"), tzone = "")), .Names = c("ID",
> > "X1", "Code.begin", "Code.end", "Code2.begin", "Code2.end"), row.n!
ames!
> > = c(NA, -7L), class = "data.frame") x <-
> > as.POSIXct(paste(substr(Sys.time(), 1, 10), "00:00:00", sep=" "))Start <-
> > rep(x, ncol(XX))a <- as.vector(na.omit(difftime(XX$Code.begin, x,
> > units="secs")))b <- as.vector(na.omit(difftime(XX$Code.end, x,
> > units="secs")))d1<-substr(as.character(x),1,10)d <- seq(x,
> > as.POSIXct(paste(d1," 01:20:00 EDT", sep="")), by=150 )e <-
> > 0:(length(d)-1)f <- na.omit(XX$Code.end)g <- paste(a, ", ", "27, ", b, ",
> > ", "27", sep="")r <- c(x, as.POSIXct(paste(d1," 01:20:00 EDT", sep="")))
> > x11(15,3)######################################plot(d, e, type="n",
> > xlab="",ylab="", axes=FALSE, xaxs = "i")axis.POSIXct(1, at=seq(r[1], r[2],
> > by="mins"), format="%H:%M:%S", tcl = -1, tick=FALSE) #tcl =
> > -0.2axis.POSIXct(1, at=seq(r[1], r[2], by=360), tcl = -1.1, labels =
> > FALSE)#, lwd=2) axis.POSIXct(1, at=seq(r[1], r[2], by=60), tcl = -.7,
> > labels = FALSE) axis.POSIXct(1, at=seq(r[1], r[2], by=15), tcl = -.35,
> > labels = FALSE) title(main="Codes Over Time of Transcript",x!
lab!
> > ="Transcript Time (min)", ylab="Codes") par(yaxt="n")lablist.y<-as.vec
> > tor(c("Code 1", "Code 2", "Code 3"))axis(2, at=seq(2, 27, length=3), labels
> > = FALSE)text(y = seq(2, 27, length=3), par("usr")[1], labels = lablist.y,
> > srt = 35, pos = 2, xpd = TRUE) grid(nx=80, ny=3, lty="solid",
> > col="gray90")box() segments(XX$Code.begin,27, XX$Code.end, 27, lwd=6,
> > lty="solid", col="black")points(c(XX$Code.begin, XX$Code.end), rep(27, 14),
> > pch=15, cex=.83)
> >
> >
> >
>
>
>
> --
> Sarah Goslee
> http://www.functionaldiversity.org
[[alternative HTML version deleted]]
______________________________________________
R-help@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.