refreshdata over a plot handle ?

classic Classic list List threaded Threaded
3 messages Options
b0b
Reply | Threaded
Open this post in threaded view
|

refreshdata over a plot handle ?

b0b
Hi,

I am trying to do this:

scatter(dataPts(:,1),dataPts(:,2));
hold on;
plot(0,0,'xDataSource','curveFitPts(:,1)','yDataSource','curveFitPts(:,2)');
hold off;
# later in a loop..
refreshdata(gcf(),'caller');
drawnow;

But the problem is, calling refreshdata over the figure handle removes the earlier scatter plot also.

I guess if there would be a way to simply do a refreshdata over a plot handle rather than the entire figure would keep the scatter plot permanently. Any body know how to do that ?

--
bob

_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: refreshdata over a plot handle ?

bpabbott
Administrator

On Feb 24, 2013, at 7:43 AM, bob wrote:

> Hi,
>
> I am trying to do this:
>
> scatter(dataPts(:,1),dataPts(:,2));
> hold on;
> plot(0,0,'xDataSource','curveFitPts(:,1)','yDataSource','curveFitPts(:,2)');
> hold off;
> # later in a loop..
> refreshdata(gcf(),'caller');
> drawnow;
>
> But the problem is, calling refreshdata over the figure handle removes the earlier scatter plot also.
>
> I guess if there would be a way to simply do a refreshdata over a plot handle rather than the entire figure would keep the scatter plot permanently. Any body know how to do that ?
>
> --
> bob

I think you'll need to "hold on" in order to preserve the other plot objects.

scatter(dataPts(:,1),dataPts(:,2));
hold on;
plot(0,0,'xDataSource','curveFitPts(:,1)','yDataSource','curveFitPts(:,2)');
hold off;
# later in a loop..
hold on;
refreshdata(gcf(),'caller');
hold off;
drawnow;

Ben

_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: refreshdata over a plot handle ?

bpabbott
Administrator
On Feb 24, 2013, at 9:14 AM, bob wrote:

> On Sun, Feb 24, 2013 at 7:30 PM, Ben Abbott <[hidden email]> wrote:
>
>> On Feb 24, 2013, at 7:43 AM, bob wrote:
>>
>> > Hi,
>> >
>> > I am trying to do this:
>> >
>> > scatter(dataPts(:,1),dataPts(:,2));
>> > hold on;
>> > plot(0,0,'xDataSource','curveFitPts(:,1)','yDataSource','curveFitPts(:,2)');
>> > hold off;
>> > # later in a loop..
>> > refreshdata(gcf(),'caller');
>> > drawnow;
>> >
>> > But the problem is, calling refreshdata over the figure handle removes the earlier scatter plot also.
>> >
>> > I guess if there would be a way to simply do a refreshdata over a plot handle rather than the entire figure would keep the scatter plot permanently. Any body know how to do that ?
>> >
>> > --
>> > bob
>>
>> I think you'll need to "hold on" in order to preserve the other plot objects.
>>
>> scatter(dataPts(:,1),dataPts(:,2));
>> hold on;
>> plot(0,0,'xDataSource','curveFitPts(:,1)','yDataSource','curveFitPts(:,2)');
>> hold off;
>> # later in a loop..
>> hold on;
>> refreshdata(gcf(),'caller');
>> hold off;
>> drawnow;
>>
>> Ben
>

> Tried it.. doesn't work.

Please keep the mail-list in the loop (reply-all).  We prefer bottom posting as it makes it easier for the reader to follow along.

        http://en.wikipedia.org/wiki/Posting_style#Bottom-posting

I don't have your script, so I created a short demo that works for me.

Ben





_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave

test_source.m (462 bytes) Download Attachment