comp.lang.idl-pvwave archive - RDF feed
type: channel
description: Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
items: Re: plots?

Re: plots?
type: item
description: helen (bin_zheng_99@yahoo.com) writes: > I have a problem about using plots. I want to use two plots for two > different data sets at the same time. If I just use one plots for one > data set, there is no problem. But when I use two, it doesn't work. It > seems the two plots interrupt each other. I want to know why? I really can't tell what you are trying to do, but if you put a couple of plots into your code so you have a good reference point, it appears you are at least plotting into both windows. I've never seen the CONTINUE keyword before, and can't really tell what it does (or is suppose to do) in this program. pro testPlots arrayT = fltarr(11) arrayX = fltarr(11) arrayY = fltarr(11) window, 1 plot,[0,10],[-10,10], /NoData x1 = !X & y1 = !Y & p1 = !P window,2 plot,[0,10],[-5,5], /NoData x2 = !X & y2 = !Y & p2 = !P for I=0, 10 Do begin arrayY[I] = cos(I+1) arrayX[I] = sin(I+1) arrayT[I] = I wset, 1 !X = x1 & !Y = x1 & !P = p1 plots,arrayT[I], arrayX[I], /continue wset, 2 !X = x2 & !Y = y2 & !P = p2 plots,arrayT[I], arrayY[I], /continue endfor end Does this give you any clues!? Are you trying to do this? arrayT = fltarr(11) arrayX = Sin(fltarr(11) + 1) arrayY = Cos(fltarr(11) + 1) Window,3, arrayT, arrayX Window, 4, arrayT, arrayY Cheers, David -- David W. Fanning, Ph.D. Fanning Software Consulting, Inc. Phone: 970-221-0438, E-mail: david@dfanning.com Coyote's Guide to IDL Programming: http://www.dfanning.com/ Toll-Free IDL Book Orders: 1-888-461-0155
creator: David Fanning
date: 2002-08-20T04:03:11-00:00

Re: plots?
type: item
description: > I have a problem about using plots. I want to use two plots for two > different data sets at the same time. If I just use one plots for one > data set, there is no problem. But when I use two, it doesn't work. It > seems the two plots interrupt each other. I want to know why? > > Thanks very much for any kind of help! > > I attach my simple program below: > > ;***************** > pro testPlots > arrayT = fltarr(11) > arrayX = fltarr(11) > arrayY = fltarr(11) > window, 1 > x1 = !X & y1 = !Y & p1 = !P > window,2 > x2 = !X & y2 = !Y & p2 = !P > for i=0, 10 Do begin > arrayY[i] = cos(i+1) > arrayX[i] = sin(i+1) > arrayT[i] = i > wset, 1 > !X = x1 & !Y = x1 & !P = p1 > plots,arrayT[i], arrayX[i], /continue > wset, 2 > !X = x2 & !Y = y2 & !P = p2 > plots,arrayT[i], arrayY[i], /continue > > endfor > > end > The /continue is telling the routine to start plotting from where the last plots was performed. When you are changing wingows the routine is continuing the plot from the point where the other window left off. If you want to plot in this manner, I would suggest letting your program keep track of where you left off. for i=0, 10 Do begin arrayY[i] = cos(i+1) arrayX[i] = sin(i+1) arrayT[i] = i if i gt 0 then begin wset, 1 !X = x1 & !Y = x1 & !P = p1 plots, arrayT[[i-1,i]], arrayX[[i-1,i]] wset, 2 !X = x2 & !Y = y2 & !P = p2 plots, arrayT[[i-1,i]], arrayY[[i-1,i]] end endfor Don
creator: Don J Lindler
date: 2002-08-20T11:51:01-00:00

Re: plots?
type: item
description: helen wrote: > Hello, All, > > I have a problem about using plots. I want to use two plots for two > different data sets at the same time. If I just use one plots for one > data set, there is no problem. But when I use two, it doesn't work. It > seems the two plots interrupt each other. I want to know why? > > Thanks very much for any kind of help! > > I attach my simple program below: > > ;***************** > pro testPlots > arrayT = fltarr(11) > arrayX = fltarr(11) > arrayY = fltarr(11) > window, 1 > x1 = !X & y1 = !Y & p1 = !P > window,2 > x2 = !X & y2 = !Y & p2 = !P > for i=0, 10 Do begin > arrayY[i] = cos(i+1) > arrayX[i] = sin(i+1) > arrayT[i] = i > wset, 1 > !X = x1 & !Y = x1 & !P = p1 > plots,arrayT[i], arrayX[i], /continue > wset, 2 > !X = x2 & !Y = y2 & !P = p2 > plots,arrayT[i], arrayY[i], /continue > > endfor > > end > > ;**************************** How about: arrayT = fltarr(11) arrayX = fltarr(11) arrayY = fltarr(11) window, 1 plot,[0,10],[-10,10], /NoData,title='plot 1' x1 = !X & y1 = !Y & p1 = !P window,0 plot,[0,10],[-5,5], /NoData,title='plot 2' x2 = !X & y2 = !Y & p2 = !P for I=1, 10 Do begin arrayY[I] = cos(I+1) arrayX[I] = sin(I+1) arrayT[I] = I endfor for I=0, 10-1 Do begin wset, 1 plots,arrayT[I], arrayX[I] plots,arrayT[I+1], arrayX[I+1], /continue wset, 0 plots,arrayT[I], arrayY[I] plots,arrayT[I+1], arrayY[I+1], /continue endfor end Cheers, bob
creator: Robert Stockwell
date: 2002-08-20T13:12:06-00:00

Re: plots?
type: item
description: David Fanning <david@dfanning.com> wrote in message news:<MPG.17cb6d6733fc1915989969@news.frii.com>... > helen (bin_zheng_99@yahoo.com) writes: > >> I have a problem about using plots. I want to use two plots for two >> different data sets at the same time. If I just use one plots for one >> data set, there is no problem. But when I use two, it doesn't work. It >> seems the two plots interrupt each other. I want to know why? > > I really can't tell what you are trying to do, but if you > put a couple of plots into your code so you have a good > reference point, it appears you are at least plotting > into both windows. I've never seen the CONTINUE keyword > before, and can't really tell what it does (or is suppose > to do) in this program. > > pro testPlots > arrayT = fltarr(11) > arrayX = fltarr(11) > arrayY = fltarr(11) > window, 1 > plot,[0,10],[-10,10], /NoData > x1 = !X & y1 = !Y & p1 = !P > window,2 > plot,[0,10],[-5,5], /NoData > x2 = !X & y2 = !Y & p2 = !P > for I=0, 10 Do begin > arrayY[I] = cos(I+1) > arrayX[I] = sin(I+1) > arrayT[I] = I > wset, 1 > !X = x1 & !Y = x1 & !P = p1 > plots,arrayT[I], arrayX[I], /continue > wset, 2 > !X = x2 & !Y = y2 & !P = p2 > plots,arrayT[I], arrayY[I], /continue > > endfor > end > > Does this give you any clues!? > > Are you trying to do this? > > arrayT = fltarr(11) > arrayX = Sin(fltarr(11) + 1) > arrayY = Cos(fltarr(11) + 1) > Window,3, arrayT, arrayX > Window, 4, arrayT, arrayY > > Cheers, > > David Hello, David, Thanks David for your help. But I still have not solved my problem. My problem is whether I can plot two different data in two windows at the same time? Because I want to track a target's movement and display its x (arrayX) and y (arrayY) position against the time (arrayT) at the real time. So that I can see the moving from the plots in these two windows. So, I write a simple program to test if I can plot two different data (arrayX against arrayT, arrayX against arrayT) at the same time and still get correct res…
creator: bin_zheng_99
date: 2002-08-20T13:26:02-00:00

Re: plots?
type: item
description: helen wrote: > David Fanning <david@dfanning.com> wrote in message > news:<MPG.17cb6d6733fc1915989969@news.frii.com>... >> helen (bin_zheng_99@yahoo.com) writes: >> >>> I have a problem about using plots. I want to use two plots for two >>> different data sets at the same time. If I just use one plots for one >>> data set, there is no problem. But when I use two, it doesn't work. It >>> seems the two plots interrupt each other. I want to know why? >> >> I really can't tell what you are trying to do, but if you >> put a couple of plots into your code so you have a good >> reference point, it appears you are at least plotting >> into both windows. I've never seen the CONTINUE keyword >> before, and can't really tell what it does (or is suppose >> to do) in this program. >> >> pro testPlots >> arrayT = fltarr(11) >> arrayX = fltarr(11) >> arrayY = fltarr(11) >> window, 1 >> plot,[0,10],[-10,10], /NoData >> x1 = !X & y1 = !Y & p1 = !P >> window,2 >> plot,[0,10],[-5,5], /NoData >> x2 = !X & y2 = !Y & p2 = !P >> for I=0, 10 Do begin >> arrayY[I] = cos(I+1) >> arrayX[I] = sin(I+1) >> arrayT[I] = I >> wset, 1 >> !X = x1 & !Y = x1 & !P = p1 >> plots,arrayT[I], arrayX[I], /continue >> wset, 2 >> !X = x2 & !Y = y2 & !P = p2 >> plots,arrayT[I], arrayY[I], /continue >> >> endfor >> end >> >> Does this give you any clues!? >> >> Are you trying to do this? >> >> arrayT = fltarr(11) >> arrayX = Sin(fltarr(11) + 1) >> arrayY = Cos(fltarr(11) + 1) >> Window,3, arrayT, arrayX >> Window, 4, arrayT, arrayY >> >> Cheers, >> >> David > > Hello, David, > > Thanks David for your help. But I still have not solved my problem. My > problem is whether I can plot two different data in two windows at the > same time? Because I want to track a target's movement and display its > x (arrayX) and y (arrayY) position against the time (arrayT) at the > real time. So that I can see the moving from the plots in these two > windows. So, I write a simple program to test if I can plot two > different data (…
creator: R.Bauer
date: 2002-08-20T14:31:56-00:00

Re: plots?
type: item
description: helen (bin_zheng_99@yahoo.com) writes: > Thanks David for your help. But I still have not solved my problem. My > problem is whether I can plot two different data in two windows at the > same time? Because I want to track a target's movement and display its > x (arrayX) and y (arrayY) position against the time (arrayT) at the > real time. So that I can see the moving from the plots in these two > windows. So, I write a simple program to test if I can plot two > different data (arrayX against arrayT, arrayX against arrayT) at the > same time and still get correct result? Is there a way to do this? I think I would drop the CONTINUE keyword and just draw from the last point to this point: pro testPlots arrayT = fltarr(11) arrayX = fltarr(11) arrayY = fltarr(11) window, 1 plot,[0,10],[-10,10], /NoData x1 = !X & y1 = !Y & p1 = !P window,2 plot,[0,10],[-10,10], /NoData x2 = !X & y2 = !Y & p2 = !P for I=1, 10 Do begin arrayY[I] = cos(I+1) arrayX[I] = sin(I+1) arrayT[I] = I wset, 1 !X = x1 & !Y = y1 & !P = p1 plots,[arrayT[i-1], arrayT[I]], $ [arrayX[i-1], arrayX[I]] wset, 2 !X = x2 & !Y = y2 & !P = p2 print, [arrayY[i-1], arrayY[I]] plots,[arrayT[i-1], arrayT[I]], $ [arrayY[i-1], arrayY[I]] endfor end This works perfectly, as far as I can tell. Cheers, David -- David W. Fanning, Ph.D. Fanning Software Consulting, Inc. Phone: 970-221-0438, E-mail: david@dfanning.com Coyote's Guide to IDL Programming: http://www.dfanning.com/ Toll-Free IDL Book Orders: 1-888-461-0155
creator: David Fanning
date: 2002-08-20T14:37:43-00:00

Re: plots?
type: item
description: Helen, IDL is more elegant than you suppose. I would suggest using arrays rather than FOR loops. (David meant findgen() rather then fltarr(), I assume.) With the plots outside of a loop, you won't need to use the /continue keyword. Whenever I need to set up a plot and then draw the plot in two steps, I use the /data keyword. Then you don't need to hassle with !X, !Y, and the like. This is done in testPlots2 below. An even more compact version is in testPlots3 below. This may or may not work for you, but I combine the creation of the plot and the actual plotting into one step using plot rather than plot & plots. They keywords to plot let you choose the domain and range (x and y) yourself, and the ystyle=1 setting allows you to force the use of [-5,5] rather than the automatically-selected [-6,6]. pro testPlots2 window, 1 plot,[0,10],[-10,10], /NoData window,2 plot,[0,10],[-5,5], /NoData I = findgen(11) arrayY = cos(I+1) arrayX = sin(I+1) arrayT = I wset, 1 plots, arrayT, arrayX, /data wset, 2 plots, arrayT, arrayY, /data end pro testPlots3 I = findgen(11) arrayY = cos(I+1) arrayX = sin(I+1) arrayT = I window, 1 plot, arrayT, arrayX, /data, xrange=[0,10], yrange=[-10,10] window, 2 plot, arrayT, arrayY, /data, xrange=[0,10], yrange=[-5,5], ystyle=1 end I hope this points you in the right direction, M. Katz
creator: MKatz843
date: 2002-08-20T18:30:06-00:00