Re: [R] Plot two separate curves in R Graphics and R Lattice package

2013-04-11 Thread David Winsemius
You need to apply the same transformation to the x argument of panel.lines as you are setting up for the panel.xyplot. -- David Sent from my iPhone On Apr 10, 2013, at 8:10 PM, jpm miao miao...@gmail.com wrote: Hi David, Thanks. How can I make the graph in log scale? Thanks

Re: [R] Plot two separate curves in R Graphics and R Lattice package

2013-04-10 Thread jpm miao
Hi David, Many thanks. I try to follow your example and code as follows: xyplot( avg_cost_2012 ~ asset_2012, panel=function(x,y) { panel.xyplot(x,y, type=p) panel.lines(x2, y1, col=red)},scales=list(x=list(log=10))) However, I do see the points p of

Re: [R] Plot two separate curves in R Graphics and R Lattice package

2013-04-10 Thread David Winsemius
On Apr 10, 2013, at 12:44 AM, jpm miao wrote: Hi David, Many thanks. I try to follow your example and code as follows: xyplot( avg_cost_2012 ~ asset_2012, panel=function(x,y) { panel.xyplot(x,y, type=p) panel.lines(x2, y1,

Re: [R] Plot two separate curves in R Graphics and R Lattice package

2013-04-10 Thread jpm miao
Thanks for your comments, David avg_cost_2012 and asset_2012 are numeric vectors of length 39 while x2 and y1 are longer vectors whose range is about the same as (avg_cost_2012, asset_2012) I also present the data by dput below. Is it clear? Thanks, Miao asset_2012 avg_cost_2012 1 3973730.0

Re: [R] Plot two separate curves in R Graphics and R Lattice package

2013-04-10 Thread David Winsemius
On Apr 10, 2013, at 6:11 PM, jpm miao wrote: Thanks for your comments, David avg_cost_2012 and asset_2012 are numeric vectors of length 39 while x2 and y1 are longer vectors whose range is about the same as (avg_cost_2012, asset_2012) I also present the data by dput below. Is it clear?

Re: [R] Plot two separate curves in R Graphics and R Lattice package

2013-04-10 Thread jpm miao
Hi David, Thanks. How can I make the graph in log scale? Thanks Miao 2013/4/11 David Winsemius dwinsem...@comcast.net On Apr 10, 2013, at 6:11 PM, jpm miao wrote: Thanks for your comments, David avg_cost_2012 and asset_2012 are numeric vectors of length 39 while x2 and y1 are

[R] Plot two separate curves in R Graphics and R Lattice package

2013-04-09 Thread jpm miao
Hi, How can I plot two curves with distinct x and y vectors? I would like to join one of them by regular lines and plot the other just by points (no lines). Can it be done in regular R graphic tools, say plot function? Can it be done in Lattice package, say xyplot function? Thanks, Miao

Re: [R] Plot two separate curves in R Graphics and R Lattice package

2013-04-09 Thread Janesh Devkota
Hi, This should be fairly easy by using base R graphics. Lets suppose your first data is represented by (x1,y1) and second data is represented by (x2,y2) You can use the following command. plot(x1,y1,type=l) points(x2,y2) Hope it helps. On Tue, Apr 9, 2013 at 8:24 PM, jpm miao

Re: [R] Plot two separate curves in R Graphics and R Lattice package

2013-04-09 Thread jpm miao
Thank you very much. Could it be done in Lattice package? Thanks, Miao 2013/4/10 Janesh Devkota janesh.devk...@gmail.com Hi, This should be fairly easy by using base R graphics. Lets suppose your first data is represented by (x1,y1) and second data is represented by (x2,y2) You can

Re: [R] Plot two separate curves in R Graphics and R Lattice package

2013-04-09 Thread David Winsemius
On Apr 9, 2013, at 8:21 PM, jpm miao wrote: Thank you very much. Could it be done in Lattice package? Your example was not presented in a form that lent itself to easy editing. Please learn to use dput to present data structures: xyplot( 4:6 ~ 1:3, panel=function(x,y) {