comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Multiple plots in one figure
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Multiple plots in one figure [message #68304] Mon, 12 October 2009 16:53
Nicki is currently offline  Nicki
Messages: 14
Registered: September 2009
Junior Member
On Oct 13, 9:59 am, David Fanning <n...@dfanning.com> wrote:
> Nicki writes:
>> Oh, okay, that was pretty easy...
>
>> Thanks!
>
>> So what if i have another equation where i put the y in and that's the
>> one I want to plot.
>> so let's say
>
>> g=5*y
>
>> and i want to plot x versus g...
>
> I've no idea what this means. But I can see you are
> pretty confused yourself. Why don't you take a few
> minutes to think very clearly about what you are trying
> to do. Maybe even write the steps down. And then look
> carefully at the example I sent you so you can see
> how it works. When you can describe it, in words,
> perhaps you can see your way clear to making this work.
>
> Cheers,
>
> David
>
> --
> David Fanning, Ph.D.
> Coyote's Guide to IDL Programming (www.dfanning.com)
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")

Yes... I got it.
Thanks a lot!!!
Re: Multiple plots in one figure [message #68305 is a reply to message #68304] Mon, 12 October 2009 15:59 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Nicki writes:

> Oh, okay, that was pretty easy...
>
> Thanks!
>
> So what if i have another equation where i put the y in and that's the
> one I want to plot.
> so let's say
>
> g=5*y
>
> and i want to plot x versus g...

I've no idea what this means. But I can see you are
pretty confused yourself. Why don't you take a few
minutes to think very clearly about what you are trying
to do. Maybe even write the steps down. And then look
carefully at the example I sent you so you can see
how it works. When you can describe it, in words,
perhaps you can see your way clear to making this work.

Cheers,

David

--
David Fanning, Ph.D.
Coyote's Guide to IDL Programming (www.dfanning.com)
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: Multiple plots in one figure [message #68306 is a reply to message #68305] Mon, 12 October 2009 15:39 Go to previous message
Nicki is currently offline  Nicki
Messages: 14
Registered: September 2009
Junior Member
Oh, okay, that was pretty easy...

Thanks!

So what if i have another equation where i put the y in and that's the
one I want to plot.
so let's say

g=5*y

and i want to plot x versus g...
Or maybe I just print my code for my specific problem:

a=70.

nrows=3.
dfov=60.
mu=438.689
r_tot=1.5
r_i=[0.1,1.0]
wdet=[25,100]

f=findgen(90)+10.

r=dfov/2/(sin(a/2/180*!pi))
z=r+f

;________________________________
for i=0,1 do begin N=2.*!pi*(r+f)/(1.1*wdet[i])*Nrows

d=sqrt(R_tot^2-(r/f)^2*(R_i[i])^2)/((r/f)+1.)-alog(2)/mu*tan (a/2*!pi/
180)

deffs=sqrt(d^2+2/mu*d*tan(a/2*!pi/180)+2/(mu^2)*(tan(a/2/180 *!pi))^2)

S=N*deffs^2/16/(r^2)*100

endfor
;____________________________________________

for i=0,1 do begin
if i eq 0 $
then plot, N, S
elso oplot, N, S, linestyle=i
endfor

Does not work... I tried to change the N and the d to N[i] and d[i]
and then also the following N and d and and also the deffs to deffs[i]
and the S to S[i]

and then

for i=0,1 do begin
if i eq 0 $
then plot, N[i], S[i] $
else oplot, N[i], S[i], linestyle=i
endfor

but that does not work either...
Re: Multiple plots in one figure [message #68309 is a reply to message #68306] Mon, 12 October 2009 05:43 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Nicki writes:

> Seriously, i am so lost, since i do not even know what keywords I have
> to look up in order find a solution for this problem... I mean the
> multiple plots in one figure are not the problem, the problem is to
> find the EASIEST way to solve this...(however i don't really know HOW
> to do the multiple plotting for this case, either)
> if i start saying (note that a[0] should belong to m[0] and a[1] to b
> [1] and so on, so that I end up with 3(!!) plots)
>
> x=findgen(10)
> m=[1,5,10]
> a=[1,4,2]
>
> y=m[i]*x+a[i]
>
> if i eq 0 then plot,x,y
> else oplot,x,y
>
>
> whaaaa, i don't know it... this does not work...

Well, it is hard to know if you are typing *actual*
code or pseudo code. But this works:

x=findgen(10)
m=[1,5,10]
a=[1,4,2]

for j=0,2 do begin
if j eq 0 $
then plot, x, m[j]*x+a[j] $
else oplot, x, m[j]*x+a[j], linestyle=j
endfor
end


Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: Multiple plots in one figure [message #68310 is a reply to message #68309] Mon, 12 October 2009 04:53 Go to previous message
Wout De Nolf is currently offline  Wout De Nolf
Messages: 194
Registered: October 2008
Senior Member
On Mon, 12 Oct 2009 03:55:37 -0700 (PDT), Nicki
<nickireiter87@yahoo.de> wrote:


> x=findgen(10)
> m=[1,5,10]
> a=[1,4,2]
>
> y=m[i]*x+a[i]
>
> if i eq 0 then plot,x,y
> else oplot,x,y
>
>
> whaaaa, i don't know it... this does not work...

You are looping over i right? So how is it not working? What do you
see?
Re: Multiple plots in one figure [message #68311 is a reply to message #68310] Mon, 12 October 2009 03:55 Go to previous message
Nicki is currently offline  Nicki
Messages: 14
Registered: September 2009
Junior Member
Seriously, i am so lost, since i do not even know what keywords I have
to look up in order find a solution for this problem... I mean the
multiple plots in one figure are not the problem, the problem is to
find the EASIEST way to solve this...(however i don't really know HOW
to do the multiple plotting for this case, either)
if i start saying (note that a[0] should belong to m[0] and a[1] to b
[1] and so on, so that I end up with 3(!!) plots)

x=findgen(10)
m=[1,5,10]
a=[1,4,2]

y=m[i]*x+a[i]

if i eq 0 then plot,x,y
else oplot,x,y


whaaaa, i don't know it... this does not work...

Please, if you cannot give me the answer, can you maybe at least give
me some keywords that i can look up...
Re: Multiple plots in one figure [message #68312 is a reply to message #68311] Sun, 11 October 2009 21:01 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Nicki writes:

> I just recently started to use IDL. I'm now having the following
> problem... i need to get one figure with multiple plots in it. I
> already know how to do this, but just in a really complicated way...
>
> say, i have the following equation: y=mx+a
>
> and for m=1 my a is 1
>
> and for m=10 my a is 2
> and let's get a third plot, let's say for m=5 and and for that case
> the a is equal to 4
> or something like that... and now i want to have one figure with the 3
> plots in it...
>
> so far i have done it like this:
>
> m1=1
> a1=1
>
> m2=10
> a2=2
>
> blaaa and then y1=m1*x+a1 and so on and then plot, overplot etc..... I
> know this is faar too complicated and there should be something far
> simpler starting with
>
> m=[1,5,10]
> a=[1,4,2] or so...
>
>
> i tried to read it up but i don't get it... something with 'if... do
> begin... else...' isn't it?! :) You see i have no idea...
>
> Can somebody help me out??

You are doing it the right way. At least, I *think* you are. :-)

Cheers,

David



--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Browse for Cloud-Free MODIS Images
Next Topic: Re: Browse for Cloud-Free MODIS Images

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 13:43:23 PDT 2025

Total time taken to generate the page: 0.00779 seconds