Showing plots in the middle of code

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

Showing plots in the middle of code

Carnë Draug-5
Hi

I'm trying to write a script that will load some files, show me the plot, and then ask if I want to save it. However, it doesn't show the plot, only at the end of the code. Heres's some code example

a = 1:4; b = 1:4;
plot(a,b);              # Graph should appear here
zenity_file_selection   # Not after this

I tried to use figure(1) and figure(1, "visible", "on") after plotting but still nothing.

Any help will be most appreciated.

Carnë Draug



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

Re: Showing plots in the middle of code

Søren Hauberg
man, 26 04 2010 kl. 13:51 -0400, skrev Carnë Draug:

> I'm trying to write a script that will load some files, show me the
> plot, and then ask if I want to save it. However, it doesn't show the
> plot, only at the end of the code. Heres's some code example
>
> a = 1:4; b = 1:4;
> plot(a,b);              # Graph should appear here
> zenity_file_selection   # Not after this
>
> I tried to use figure(1) and figure(1, "visible", "on") after plotting
> but still nothing.
>
> Any help will be most appreciated.

Call 'drawnow'

Søren

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

Showing plots in the middle of code

John W. Eaton
Administrator
In reply to this post by Carnë Draug-5
On 26-Apr-2010, Carn  Draug wrote:

| I'm trying to write a script that will load some files, show me the plot,
| and then ask if I want to save it. However, it doesn't show the plot, only
| at the end of the code. Heres's some code example
|
| a = 1:4; b = 1:4;
| plot(a,b);              # Graph should appear here
| zenity_file_selection   # Not after this
|
| I tried to use figure(1) and figure(1, "visible", "on") after plotting but
| still nothing.
|
| Any help will be most appreciated.

Maybe the drawnow function will help?

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

Re: Showing plots in the middle of code

Carnë Draug-5
In reply to this post by Søren Hauberg
On 26 April 2010 14:04, Søren Hauberg <[hidden email]> wrote:
> Call 'drawnow'

This is exactly what I needed.

2010/4/26 Thomas D. Dean <[hidden email]>:
> a=[1:4];b=[1:4];
> hold on
> plot(a,b)
> hold off
> x=input ("Pick a number, any number! ");

This works with input but not with zenity_file_selection, no idea why.

Thank you both,
Carnë Draug

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

Re: Showing plots in the middle of code

Søren Hauberg
man, 26 04 2010 kl. 14:18 -0400, skrev Carnë Draug:
> 2010/4/26 Thomas D. Dean <[hidden email]>:
> > a=[1:4];b=[1:4];
> > hold on
> > plot(a,b)
> > hold off
> > x=input ("Pick a number, any number! ");
>
> This works with input but not with zenity_file_selection, no idea why.

Functions like 'input' and 'pause' call 'drawnow'. I guess the 'zenity'
functions could be modified to do the same.

Søren

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

Re: Showing plots in the middle of code

Sebastian Schöps
In reply to this post by Carnë Draug-5
Hi,

did you try to run "drawnow"?

http://www.gnu.org/software/octave/doc/interpreter/Two_002dDimensional-Plotting.html

Bye
Sebastian

Am 26.04.10 19:51, schrieb Carnë Draug:

> Hi
>
> I'm trying to write a script that will load some files, show me the
> plot, and then ask if I want to save it. However, it doesn't show the
> plot, only at the end of the code. Heres's some code example
>
> a = 1:4; b = 1:4;
> plot(a,b);              # Graph should appear here
> zenity_file_selection   # Not after this
>
> I tried to use figure(1) and figure(1, "visible", "on") after plotting
> but still nothing.
>
> Any help will be most appreciated.
>
> Carnë Draug
>
>
>
>
> _______________________________________________
> Help-octave mailing list
> [hidden email]
> https://www-old.cae.wisc.edu/mailman/listinfo/help-octave

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

Re: Showing plots in the middle of code

Carnë Draug-5
In reply to this post by Søren Hauberg
On 26 April 2010 14:26, Søren Hauberg <[hidden email]> wrote:
> Functions like 'input' and 'pause' call 'drawnow'. I guess the 'zenity'
> functions could be modified to do the same.

It's done, just made the comit for those changes. Thanks for the explanations,

Carnë

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

Re: Showing plots in the middle of code

stn
In reply to this post by Carnë Draug-5


2010/4/26 Carnë Draug <carandraug.ml@gmail.com>
Hi

I'm trying to write a script that will load some files, show me the plot, and then ask if I want to save it. However, it doesn't show the plot, only at the end of the code. Heres's some code example

a = 1:4; b = 1:4;
plot(a,b);              # Graph should appear here
zenity_file_selection   # Not after this

a = 1:4; b = 1:4;
plot(a,b);              # Graph should appear here
printf("plot may take a few seconds to appear, wait a moment.\n")
printf("View plot, then press enter to continue...\n")
pause
zenity_file_selection   # Not after this



Any help will be most appreciated.

Carnë Draug



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



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

Re: Showing plots in the middle of code

stn


2010/4/26 Stefan Neumann <[hidden email]>


2010/4/26 Carnë Draug <carandraug.ml@gmail.com>

Hi

I'm trying to write a script that will load some files, show me the plot, and then ask if I want to save it. However, it doesn't show the plot, only at the end of the code. Heres's some code example

a = 1:4; b = 1:4;
plot(a,b);              # Graph should appear here
zenity_file_selection   # Not after this


This works too (windows XP, not sure about Linux).  Both the graph and the file-selection appear after a few seconds. If you do not want to save then press ESC in zenity.

a = 1:4; b = 1:4;
plot(a,b);              # Graph should appear here
sleep(1);
zenity_file_selection   # Not after this



Any help will be most appreciated.

Carnë Draug



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




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

Re: Showing plots in the middle of code

Chengqi Chang
In reply to this post by Carnë Draug-5
On Tue, 27 Apr 2010 05:09:09 +0800, <[hidden email]> wrote:

| I'm trying to write a script that will load some files, show me the plot,
| and then ask if I want to save it. However, it doesn't show the plot,  
only
| at the end of the code. Heres's some code example
|
| a = 1:4; b = 1:4;
| plot(a,b);              # Graph should appear here
| zenity_file_selection   # Not after this
|
| I tried to use figure(1) and figure(1, "visible", "on") after plotting  
but
| still nothing.
|
| Any help will be most appreciated.

I recall that fflush(1) may satisfy your need.
--
Best Regards!
---------------------------
Sincerely,                      Chengqi Zhang
China Center for Economic Research
Mail: [hidden email]
Personal Website: http://macro2.cn
_______________________________________________
Help-octave mailing list
[hidden email]
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave