Plotting

View: New views
10 Messages — Rating Filter:   Alert me  

Plotting

by asha g :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



I am trying to plot two plots on the same plot :;
hold on
deltaT = 0.0035; niter = 10000;
t = linspace ( 0,deltaT*niter, niter)
vv1 = vvvv(:,1);
vvN = vvvv(:,N);

plot(t,vv1,'r*')
plot(t,vvN,'b')

hold off

I am only getting one plot in blue but the legend says vv1.

I am using octave 3.03 in a Centos environment.

Both vv1 and vvN are generating values that are different and should thus plot. Could someone help me.
Thanks
Asha


      Check out the all-new Messenger 9.0! Go to http://in.messenger.yahoo.com/

_______________________________________________
Help-octave mailing list
Help-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave

Re: Plotting

by martin_helm :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


asha g wrote:

I am trying to plot two plots on the same plot :;
hold on
deltaT = 0.0035; niter = 10000;
t = linspace ( 0,deltaT*niter, niter)
vv1 = vvvv(:,1);
vvN = vvvv(:,N);

plot(t,vv1,'r*')
plot(t,vvN,'b')

hold off

I am only getting one plot in blue but the legend says vv1.

I am using octave 3.03 in a Centos environment.

Both vv1 and vvN are generating values that are different and should thus plot. Could someone help me.
Thanks
Asha


      Check out the all-new Messenger 9.0! Go to http://in.messenger.yahoo.com/

_______________________________________________
Help-octave mailing list
Help-octave@octave.org
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
Simply add a "hold on" after the first and before the second plot command.

- mh

Re: Plotting

by Ben Abbott :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On Apr 13, 2009, at 5:54 AM, asha g wrote:

> I am trying to plot two plots on the same plot :;
> hold on
> deltaT = 0.0035; niter = 10000;
> t = linspace ( 0,deltaT*niter, niter)
> vv1 = vvvv(:,1);
> vvN = vvvv(:,N);
>
> plot(t,vv1,'r*')
> plot(t,vvN,'b')
>
> hold off
>
> I am only getting one plot in blue but the legend says vv1.
>
> I am using octave 3.03 in a Centos environment.
>
> Both vv1 and vvN are generating values that are different and should  
> thus plot. Could someone help me.
> Thanks
> Asha

There is a but in your version of octave. Try this ...

> plot(t,vv1,'r*')
> hold on
> plot(t,vvN,'b')
> hold off

Ben
_______________________________________________
Help-octave mailing list
Help-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave

Re: Plotting

by John W. Eaton-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 13-Apr-2009, Ben Abbott wrote:

| On Apr 13, 2009, at 5:54 AM, asha g wrote:
|
| > I am trying to plot two plots on the same plot :;
| > hold on
| > deltaT = 0.0035; niter = 10000;
| > t = linspace ( 0,deltaT*niter, niter)
| > vv1 = vvvv(:,1);
| > vvN = vvvv(:,N);
| >
| > plot(t,vv1,'r*')
| > plot(t,vvN,'b')
| >
| > hold off
| >
| > I am only getting one plot in blue but the legend says vv1.
| >
| > I am using octave 3.03 in a Centos environment.
| >
| > Both vv1 and vvN are generating values that are different and should  
| > thus plot. Could someone help me.
| > Thanks
| > Asha
|
| There is a but in your version of octave. Try this ...
|
| > plot(t,vv1,'r*')
| > hold on
| > plot(t,vvN,'b')
| > hold off

It should also work if the order is

  hold on
  x = -10:0.01:10;
  plot (x, sin (x));
  plot (x, cos (x));
  hold off

If that's not working properly, then there is a bug, but I don't know
what would be cuasing it.  It works properly for me with
Octave 3.0.4, 3.1.54, and the current development sources.  Does my
simple example above that plots sine and cosine waves work for you?

jwe
_______________________________________________
Help-octave mailing list
Help-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave

Re: Plotting

by Ben Abbott :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

 On Monday, April 13, 2009, at 11:28AM, "John W. Eaton" <jwe@...> wrote:

>On 13-Apr-2009, Ben Abbott wrote:
>
>| On Apr 13, 2009, at 5:54 AM, asha g wrote:
>|
>| > I am trying to plot two plots on the same plot :;
>| > hold on
>| > deltaT = 0.0035; niter = 10000;
>| > t = linspace ( 0,deltaT*niter, niter)
>| > vv1 = vvvv(:,1);
>| > vvN = vvvv(:,N);
>| >
>| > plot(t,vv1,'r*')
>| > plot(t,vvN,'b')
>| >
>| > hold off
>| >
>| > I am only getting one plot in blue but the legend says vv1.
>| >
>| > I am using octave 3.03 in a Centos environment.
>| >
>| > Both vv1 and vvN are generating values that are different and should  
>| > thus plot. Could someone help me.
>| > Thanks
>| > Asha
>|
>| There is a but in your version of octave. Try this ...
>|
>| > plot(t,vv1,'r*')
>| > hold on
>| > plot(t,vvN,'b')
>| > hold off
>
>It should also work if the order is
>
>  hold on
>  x = -10:0.01:10;
>  plot (x, sin (x));
>  plot (x, cos (x));
>  hold off
>
>If that's not working properly, then there is a bug, but I don't know
>what would be cuasing it.  It works properly for me with
>Octave 3.0.4, 3.1.54, and the current development sources.  Does my
>simple example above that plots sine and cosine waves work for you?
>
>jwe
>

Your example does not work for me running 3.0.3, but does work for 3.1.54.

Ben


_______________________________________________
Help-octave mailing list
Help-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave

Parent Message unknown Re: Plotting

by asha g :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Thanks everyone for the help. I did add the hold on between both plots and got the desired result. Now did things change from Octave 3.0 to 3.03 as I could plot in Octave 3.0 without the hold in between the plots.
Also, what if I have more than 2 plots. Where do I put the hold command?
Asha

> >
> > I am trying to plot two plots on the same plot :;
> > hold on
> > deltaT = 0.0035; niter = 10000;
> > t = linspace ( 0,deltaT*niter, niter)
> > vv1 = vvvv(:,1);
> > vvN = vvvv(:,N);
> >
> > plot(t,vv1,'r*')
> > plot(t,vvN,'b')
> >
> > hold off
> >
> > I am only getting one plot in blue but the legend says
> vv1.
> >
> > I am using octave 3.03 in a Centos environment.
> >
> > Both vv1 and vvN are generating values that are
> different and should thus
> > plot. Could someone help me.
> > Thanks
> > Asha
> >
> >
> >       Check out the all-new
> Messenger 9.0! Go to
> > http://in.messenger.yahoo.com/
> >
> > _______________________________________________
> > Help-octave mailing list
> > Help-octave@...
> > https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
> >
> >
>
> Simply add a "hold on" after the first and before the
> second plot command.
>
> - mh
>
> --
> View this message in context: http://www.nabble.com/Plotting-tp23020319p23020941.html
> Sent from the Octave - General mailing list archive at
> Nabble.com.
>
> _______________________________________________
> Help-octave mailing list
> Help-octave@...
> https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
>


      Add more friends to your messenger and enjoy! Go to http://messenger.yahoo.com/invite/

_______________________________________________
Help-octave mailing list
Help-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave

Re: Plotting

by martin_helm :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


asha g wrote:
Thanks everyone for the help. I did add the hold on between both plots and got the desired result. Now did things change from Octave 3.0 to 3.03 as I could plot in Octave 3.0 without the hold in between the plots.
Also, what if I have more than 2 plots. Where do I put the hold command?
Asha

> >
> > I am trying to plot two plots on the same plot :;
> > hold on
> > deltaT = 0.0035; niter = 10000;
> > t = linspace ( 0,deltaT*niter, niter)
> > vv1 = vvvv(:,1);
> > vvN = vvvv(:,N);
> >
> > plot(t,vv1,'r*')
> > plot(t,vvN,'b')
> >
> > hold off
> >
> > I am only getting one plot in blue but the legend says
> vv1.
> >
> > I am using octave 3.03 in a Centos environment.
> >
> > Both vv1 and vvN are generating values that are
> different and should thus
> > plot. Could someone help me.
> > Thanks
> > Asha
> >
> >
> >       Check out the all-new
> Messenger 9.0! Go to
> > http://in.messenger.yahoo.com/
> >
> > _______________________________________________
> > Help-octave mailing list
> > Help-octave@octave.org
> > https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
> >
> >
>
> Simply add a "hold on" after the first and before the
> second plot command.
>
> - mh
>
> --
> View this message in context: http://www.nabble.com/Plotting-tp23020319p23020941.html
> Sent from the Octave - General mailing list archive at
> Nabble.com.
>
> _______________________________________________
> Help-octave mailing list
> Help-octave@octave.org
> https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
>


      Add more friends to your messenger and enjoy! Go to http://messenger.yahoo.com/invite/

_______________________________________________
Help-octave mailing list
Help-octave@octave.org
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
I checked again with 3.0.3 and you need a hold on before every further plot command:

plot (...)
hold on
plot(...)
hold on
plot(..)
hold on
plot(...)

and so on (somewhat ugly). With the development version 3.1.55 this is not necessary.
I could not check with 3.0.5 since I did not install it.

- mh

Re: Plotting

by Michael Grossbach :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

martin_helm wrote:

>
>
> asha g wrote:
>>
>> Thanks everyone for the help. I did add the hold on between both plots and
>> got the desired result. Now did things change from Octave 3.0 to 3.03 as I
>> could plot in Octave 3.0 without the hold in between the plots.
>> Also, what if I have more than 2 plots. Where do I put the hold command?
>> Asha
>>
>>>> I am trying to plot two plots on the same plot :;
>>>> hold on
>>>> deltaT = 0.0035; niter = 10000;
>>>> t = linspace ( 0,deltaT*niter, niter)
>>>> vv1 = vvvv(:,1);
>>>> vvN = vvvv(:,N);
>>>>
>>>> plot(t,vv1,'r*')
>>>> plot(t,vvN,'b')
>>>>
>>>> hold off
>>>>
>>>> I am only getting one plot in blue but the legend says
>>> vv1.
>>>> I am using octave 3.03 in a Centos environment.
>>>>
>>>> Both vv1 and vvN are generating values that are
>>> different and should thus
>>>> plot. Could someone help me.
>>>> Thanks
>>>> Asha
>>>>
>>>>
>>>>       Check out the all-new
>>> Messenger 9.0! Go to
>>>> http://in.messenger.yahoo.com/
>>>>
>>>> _______________________________________________
>>>> Help-octave mailing list
>>>> Help-octave@...
>>>> https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
>>>>
>>>>
>>> Simply add a "hold on" after the first and before the
>>> second plot command.
>>>
>>> - mh
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Plotting-tp23020319p23020941.html
>>> Sent from the Octave - General mailing list archive at
>>> Nabble.com.
>>>
>>> _______________________________________________
>>> Help-octave mailing list
>>> Help-octave@...
>>> https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
>>>
>>
>>       Add more friends to your messenger and enjoy! Go to
>> http://messenger.yahoo.com/invite/
>>
>> _______________________________________________
>> Help-octave mailing list
>> Help-octave@...
>> https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
>>
>>
>
> I checked again with 3.0.3 and you need a hold on before every further plot
> command:
>
> plot (...)
> hold on
> plot(...)
> hold on
> plot(..)
> hold on
> plot(...)
>
> and so on (somewhat ugly). With the development version 3.1.55 this is not
> necessary.
> I could not check with 3.0.5 since I did not install it.
>
> - mh
>
With Octave 3.0.3 on Windows everything works as expected, so

plot (...)
hold on
plot(...)
plot(..)
hold off

does show three graphs.

Michael
_______________________________________________
Help-octave mailing list
Help-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave

Re: Plotting

by martin_helm :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Michael Grossbach wrote:
martin_helm wrote:
>
>
> asha g wrote:
>>
>> Thanks everyone for the help. I did add the hold on between both plots and
>> got the desired result. Now did things change from Octave 3.0 to 3.03 as I
>> could plot in Octave 3.0 without the hold in between the plots.
>> Also, what if I have more than 2 plots. Where do I put the hold command?
>> Asha
>>
>>>> I am trying to plot two plots on the same plot :;
>>>> hold on
>>>> deltaT = 0.0035; niter = 10000;
>>>> t = linspace ( 0,deltaT*niter, niter)
>>>> vv1 = vvvv(:,1);
>>>> vvN = vvvv(:,N);
>>>>
>>>> plot(t,vv1,'r*')
>>>> plot(t,vvN,'b')
>>>>
>>>> hold off
>>>>
>>>> I am only getting one plot in blue but the legend says
>>> vv1.
>>>> I am using octave 3.03 in a Centos environment.
>>>>
>>>> Both vv1 and vvN are generating values that are
>>> different and should thus
>>>> plot. Could someone help me.
>>>> Thanks
>>>> Asha
>>>>
>>>>
>>>>       Check out the all-new
>>> Messenger 9.0! Go to
>>>> http://in.messenger.yahoo.com/
>>>>
>>>> _______________________________________________
>>>> Help-octave mailing list
>>>> Help-octave@octave.org
>>>> https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
>>>>
>>>>
>>> Simply add a "hold on" after the first and before the
>>> second plot command.
>>>
>>> - mh
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Plotting-tp23020319p23020941.html
>>> Sent from the Octave - General mailing list archive at
>>> Nabble.com.
>>>
>>> _______________________________________________
>>> Help-octave mailing list
>>> Help-octave@octave.org
>>> https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
>>>
>>
>>       Add more friends to your messenger and enjoy! Go to
>> http://messenger.yahoo.com/invite/
>>
>> _______________________________________________
>> Help-octave mailing list
>> Help-octave@octave.org
>> https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
>>
>>
>
> I checked again with 3.0.3 and you need a hold on before every further plot
> command:
>
> plot (...)
> hold on
> plot(...)
> hold on
> plot(..)
> hold on
> plot(...)
>
> and so on (somewhat ugly). With the development version 3.1.55 this is not
> necessary.
> I could not check with 3.0.5 since I did not install it.
>
> - mh
>
With Octave 3.0.3 on Windows everything works as expected, so

plot (...)
hold on
plot(...)
plot(..)
hold off

does show three graphs.

Michael
_______________________________________________
Help-octave mailing list
Help-octave@octave.org
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
Just to be complete:

I downloaded 3.0.5 and compiled it (Opensuse 1.1, 64bit)

then the example from jwe

 hold on
  x = -10:0.01:10;
  plot (x, sin (x));
  plot (x, cos (x));
  hold off

works also. So the different behaviour seems to be only in 3.0.3.


Re: Plotting

by andy buckle :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

figure
hold on
plot
plot
works for me (and is helpful if you want to do the plots in a loop).