Thanks Romain for trying to help, but my issue is that I have three time series, not two, so at least two of them would have to go on the same side.
There may be no solution to this problem in R but if there is, would appreciate hearing about it from someone ? Figure 1 in this link shows what I am trying to achieve: http://www.aditus.nu/jpgraph/howto04.php Thanks anyway, Tolga Romain Francois <[EMAIL PROTECTED]> 30/06/2008 10:51 To [EMAIL PROTECTED] cc Matt Aldridge <[EMAIL PROTECTED]> Subject Re: [R] Plotting three time series on the same graph Hello Tolga, I am not sure what you are looking for is achievable easily, however, you can have an axis on the left and another on the right. Look at the side argument of the axis function. Would the following code work for you: # generating some data y <- 1:100 + runif( 100, min = -10, max = 10 ) x <- 1:100 + runif( 100, min = -10, max = 10 ) z <- seq( 70000, 25000, length.out = 100) + runif( 100, min = -2000, max = 2000) # prettier version of lines .myLines <- function(x,y, col = "blue", lwd = 2, ...){ lines( x,y,col = "black", lwd=2 + lwd) lines( x,y,col = col, lwd=lwd, ...) } # transform from the scale c(25000,70000) to (0,100) transform <- function( data ){ ( data - 25000 ) / ( 70000 - 25000 ) * 100 } par( mar = c(5,4,4,4)+.1 ) plot( 1:100, x , type = "n", las = 1 ) axs <- pretty( c(25000, 70000), n = 5 ) abline( h = transform(axs), col = "gray") .myLines( 1:100, x, col = "red" ) .myLines( 1:100, y, col = "blue" ) .myLines( 1:100, transform(z), col = "green" ) axis( 4, transform(axs), axs, las = 1 ) Best Regards, Romain Francois -- Mango Solutions data analysis that delivers Tel: +44(0) 1249 76 77 00 Fax: +44(0) 1249 76 77 07 Mob: +44(0) 7813 52 61 23 R for finance course: 8th-10th july. London The R Language: 9th-10th september. London More courses from: http://www.mango-solutions.com/services/rtraining/r_schedule.html [EMAIL PROTECTED] wrote: > Dear R Users, > > I would like to plot three time series on the same graph, two axis on the > left and one axis on the right. > > The time series that I am graphing on the left do not share a similar > scale: one has a range of 1:100 and the other a range of 25000:70000. How > can I display the tick marks for both on the left hand side without > superimposing them, i.e. one set of tick marks in black right up on the > edge of the plot and another set of tick marks in red placed further to > the left so that the tick marks and axis identifiers do not sit on top of > each other ? > > Many thanks in advance, > Tolga > [attachment "plot3timeseries.png" deleted by Tolga I Uzuner/JPMCHASE] Generally, this communication is for informational purposes only and it is not intended as an offer or solicitation for the purchase or sale of any financial instrument or as an official confirmation of any transaction. In the event you are receiving the offering materials attached below related to your interest in hedge funds or private equity, this communication may be intended as an offer or solicitation for the purchase or sale of such fund(s). All market prices, data and other information are not warranted as to completeness or accuracy and are subject to change without notice. Any comments or statements made herein do not necessarily reflect those of JPMorgan Chase & Co., its subsidiaries and affiliates. This transmission may contain information that is privileged, confidential, legally privileged, and/or exempt from disclosure under applicable law. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein (including any reliance thereon) is STRICTLY PROHIBITED. Although this transmission and any attachments are believed to be free of any virus or other defect that might affect any computer system into which it is received and opened, it is the responsibility of the recipient to ensure that it is virus free and no responsibility is accepted by JPMorgan Chase & Co., its subsidiaries and affiliates, as applicable, for any loss or damage arising in any way from its use. If you received this transmission in error, please immediately contact the sender and destroy the material in its entirety, whether in electronic or hard copy format. Thank you. Please refer to http://www.jpmorgan.com/pages/disclosures for disclosures relating to UK legal entities. [[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.