[R] How to plot graph with different scale (y axis) on same graph?
Jim Lemon
jim at bitwrit.com.au
Thu Apr 26 13:31:13 CEST 2012
On 04/26/2012 08:02 PM, Manish Gupta wrote:
> Hi,
>
> I have my data in below format.
>
> position var1 var2
> 2 .1 10
> 3 .29 89
> 12 .56 100
> 425 .34 1234
> 6546 .12 21
> .... ..... .....
> .... ..... ......
> .... ..... ......
>
> I need to plot a grpah for above with position as x - axis and two variables
> with as line on the same plot. I have 5 million records. How can i
> implement it efficiently.
>
Hi Manish,
You can plot this with twoord.plot (plotrix):
position<-c(2,3,12,425,6546)
var1<-c(.1,.29,.56,.34,.12)
var2<-c(10,89,100,1234,21)
library(plotrix)
twoord.plot(lx=position,ly=var1,rx=position,ry=var2)
but with 5 million records you will just have a jagged block of color. I
think ghostwheel's suggestion of reducing the number of points is very
sensible.
Jim
More information about the R-help
mailing list