# [R-SIG-Finance] Two x and two y vectors in one X-Y coordinatesystem graph

Cedrick W. Johnson cedrick at cedrickjohnson.com
Sat Apr 10 15:10:32 CEST 2010

```I would ask this on the r-help list...

-c
Sent from my BlackBerry®

-----Original Message-----
From: Rajat Tayal  <rajat at igidr.ac.in>
Date: Sat, 10 Apr 2010 18:18:20
To: <r-sig-finance at stat.math.ethz.ch>
Subject: [R-SIG-Finance] Two x and two y vectors in one X-Y coordinate
system graph

Hi all,
I have two line graphs drawn with two different pairs of x and y vectors.
The sample dataset is given below. Here, I have two X vectors assuming positive values.
Only one of the y vectors assumes positive values, while the other y vector assumes negative values.

X1

Y1

X2

Y2

35

0.000534

265

-0.000534

47

0.000639

281

-0.000570

65

0.000744

282

-0.000572

865

0.001312

283

-0.000575

1265

0.001342

284

-0.000579

1315

0.001346

285

-0.000584

1325

0.001347

885

-0.001635

1472

0.001362

886

-0.001636

1477

0.001364

887

-0.001637

1536

0.001386

888

-0.001638

1541

0.001388

889

-0.001640

2492

0.001617

890

-0.001641

2506

0.001622

920

-0.001688

2516

0.001626

970

-0.001761

I am able to plot them as separate graphs using :
pdf("plot.pdf", height=9, width=6)
par(mfrow=c(1,2))
plot(y=y1, x=x1, lwd=2, col="blue", type="l")
plot(y=y2, x=x2, lwd=2, col="red", type="l")
dev.off()
but would like to plot them on one graph in a X-Y coordinate system setup .
The idea is to somehow flip one of the curves to the third quadrant of the X-Y coordinate space while the other curve is in the first quadrant.
How do I plot the two graphs in one figure ???
Any help would be highly useful.

Rajat Tayal
Ph.D Economics Candidate
Indira Gandhi Institute of Development Research,
Gen A.K.Vaidya Marg, Filmcity Road,
Santosh Nagar, Goregaon (East),
MUMBAI- 400 065.
02228416285, 09987284080
[[alternative HTML version deleted]]

_______________________________________________
R-SIG-Finance at stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only. If you want to post, subscribe first.
-- Also note that this is not the r-help list where general R questions should go.
```