Dear R Users, I have the following situations to plot. x-values (times) : range from 0 to 104 (in weeks) y-values (hazards) : range from 0 to 0.5 Now I want to make a plot of time versus hazards such that in the time axis (i.e x-axis) the values 0-24 occupies half of the axis and the values 25-104 ocupies the rest of the axis. In other words I want to emphasize on first 24 weeks so that the features of the hazard are more pronounced for these values. Anybody with ideas how I can accomplish this ? Thanks in advance With kind regards Anthony [[alternative HTML version deleted]]
Please consider the following:
plot(0:1, axes=F)
axis(1)
If you read the help page for "axis" and work the examples
there,
you may be able to figure it out. Hint: Develop a function, say, fn,
to shrink 25-104 to 25-50 leaving x < 25 unchanged. Then the following
should work for you:
plot(fn(x), y, axes=F) # where x and y are the numbers you want to plot.
axis(1, fn(xlabs), xlabs) # where xlabs = numbers for which you want
tick marks and labels
axis(2)
I did NOT TEST this particular piece of code, but I've done things
like this in the past, and they worked.
hope this helps.
spencer graves
Anthony Gichangi wrote:
>Dear R Users,
>I have the following situations to plot.
>
>x-values (times) : range from 0 to 104 (in weeks)
>y-values (hazards) : range from 0 to 0.5
>
>Now I want to make a plot of time versus hazards such
>that in the time axis (i.e x-axis) the values 0-24 occupies
>half of the axis and the values 25-104 ocupies the rest
>of the axis.
>
>In other words I want to emphasize on first 24 weeks so that
>the features of the hazard are more pronounced for these
>values.
>
>Anybody with ideas how I can accomplish this ?
>
>
>Thanks in advance
>
>
>With kind regards
>
>Anthony
>
>
>
> [[alternative HTML version deleted]]
>
>______________________________________________
>R-help at stat.math.ethz.ch mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html
>
>
--
Spencer Graves, PhD, Senior Development Engineer
O: (408)938-4420; mobile: (408)655-4567
x <- c(0:24, (25:104-24)/(104-24)*25+24) y <- 0.5*(104-104:0)/104 plot(x,y, xaxt = "n") axis(1, at = 0:49, labels = c(0:24, (25:49-24)*(104-24)/25+24)) ----- Original Message ----- From: Anthony Gichangi <anthony at stat.sdu.dk> Date: Tuesday, December 28, 2004 12:57 pm Subject: [R] Varying x-axes ticks> Dear R Users, > I have the following situations to plot. > > x-values (times) : range from 0 to 104 (in weeks) > y-values (hazards) : range from 0 to 0.5 > > Now I want to make a plot of time versus hazards such > that in the time axis (i.e x-axis) the values 0-24 occupies > half of the axis and the values 25-104 ocupies the rest > of the axis. > > In other words I want to emphasize on first 24 weeks so that > the features of the hazard are more pronounced for these > values. > > Anybody with ideas how I can accomplish this ? > > > Thanks in advance > > > With kind regards > > Anthony > > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting- > guide.html