Hi,

I changed the code.  The first two curves seem to plot properly without 
the 'ylim'. 'ylim' doesn't allow the first two curves to plot properly.
It doesn't have any effect on the 3rd curve.

plot(data$Time,as.numeric(data$Used),ylim=c(min(as.numeric(data$Used)),max(data$Max)),col="green",pch=16,type="b", 
ylab="MegaBytes", xlab="",las=2,lwd=2,xaxt="n", cex.lab=1.2,cex.axis=1.2)
axis(1,at = seq(min(data$Time), max(data$Time), by=1000),las = 
2,cex.axis=1)

title("Time vs Used Code cache,Committed and Maximum Code 
cache",cex.main=1.5,xlab="Time(Every 200 Seconds)")

points(data$Time,as.numeric(data$Committed),col="orangered",pch=16,lwd=2, 
cex.lab=1.2,cex.axis=1,type="b")
points(data$Time,as.numeric(data$Max),col="palevioletred3",pch=16,lwd=2, 
cex.lab=1.2,cex.axis=1,type="b")

Thanks.




From:   Jim Lemon <jim@bitwrit.com.au>
To:     mohan.radhakrishnan@polarisft.com
Cc:     r-help@r-project.org
Date:   11/04/2013 04:45 PM
Subject:        Re: [R] All curves with same y-axis scale



On 11/04/2013 08:54 PM, mohan.radhakrishnan@polarisft.com wrote:
> Hi,
>
> When I plot 3 curves with the same x-axis and same y-axis, the first two
> curves honor the y-axis but the last one doesn't. When I remove yaxt="n"
> for the last curve a new scale appears on the y-axis along with the 
scales
> that the first two curves use. I want all curves to use the same y-axis
> scale.
>
> What is missing ?
>
>         Init             Used        Committed    Max        Time
> 1   2359296 13913536  13959168 50331648   200
> 2   2359296 13915200  13959168 50331648   400
> 3   2359296 13947712  13991936 50331648   600
> 4   2359296 13956224  13991936 50331648   800
> 5   2359296 13968832  14024704 50331648  1000
> 6   2359296 13978048  14024704 50331648  1200
> 7   2359296 14012416  14090240 50331648  1400
> 8   2359296 14450304  14548992 50331648  1600
> 9   2359296 14521024  14548992 50331648  1800
> 10  2359296 14536320  14548992 50331648  2000
> 11  2359296 14553344  14581760 50331648  2200
>
> plot(data$Time,as.numeric(data$Used),col="green",pch=16,type="b",
> ylab="MegaBytes", xlab="",las=2,lwd=2,xaxt="n", cex.lab=1.2,cex.axis=1)
> axis(1,at = seq(min(data$Time), max(data$Time), by=1000),las =
> 2,cex.axis=1)
> title("Time vs Used Code cache,Committed and Maximum Code
> cache",cex.main=1.5,xlab="Time(Seconds)")
>
> par(new=T)
> 
plot(data$Time,as.numeric(data$Committed),col="orangered",pch=16,type="b",
> ylab="MegaBytes", xlab="",las=2,lwd=2,xaxt="n",
> cex.lab=1.2,cex.axis=1,yaxt="n")
>
> par(new=T)
> 
plot(data$Time,as.numeric(data$Max),col="palevioletred3",pch=16,type="b",
> ylab="MegaBytes", xlab="",las=2,lwd=2,xaxt="n",
> cex.lab=1.2,cex.axis=1,yaxt="n")
>
Hi Mohan,
This is because the ranges of "Used" and "Committed" are so close that 
you probably didn't notice the difference. "Max" is just a straight line 
way off the two original plots. If you want to show these three widely 
varying values on the same plot, use the lines or points function for 
the second two sets of values and set your ylim in the first plot to 
contain all the values to be plotted.

You might also look at the gap.plot function in plotrix if you want to 
avoid two lines at the bottom of the plot and one line right at the top:

gap.plot(data$Time,data$Used,gap=c(15000000,49000000),
  ylim=c(13500000,50500000),type="b",pch="U")
gap.plot(data$Time,data$Committed,gap=c(15000000,49000000),
  type="b",pch="C",add=TRUE)
gap.plot(data$Time,data$Max,gap=c(15000000,49000000),
  type="b",pch="M",add=TRUE)

Jim




This e-Mail may contain proprietary and confidential information and is sent for the intended recipient(s) only.  If by an addressing or transmission error this mail has been misdirected to you, you are requested to delete this mail immediately. You are also hereby notified that any use, any form of reproduction, dissemination, copying, disclosure, modification, distribution and/or publication of this e-mail message, contents or its attachment other than by its intended recipient/s is strictly prohibited.

Visit us at http://www.polarisFT.com

	[[alternative HTML version deleted]]

