[Scilab-users] Running an .sce from the command line. message 9 (scilab: message 11 of 20) of 20)

Tim Wescott tim at wescottdesign.com
Fri Apr 1 19:35:37 CEST 2016


>From it's behavior, plot2d treats log(0) as a null point, or as a point
that's "way down there".  I don't know the details, but it's apparent
when you plot it (and it works).

plot2d, as you've found, treats colors differently than plot.  "plot" is
sort of the Matlab-ish way of doing things, while plot2d is native
Scilab.  Normally you just set the colors with a "style" statement; if
you want fine control over line colors then read up on "colormap" in the
help system.

There's a Matlab log-log plot style -- I think it's loglog, semilogx and
semilogy.  If you want to stick with Matlab style plotting you can
investigate these -- but I don't use 'em, so I can make no promises.

On Thu, 2016-03-31 at 16:56 -0800, scilab.20.browseruk at xoxy.net wrote:
> Tim, 
> 
> I've implemented that, and it certainly avoids the singularity; but creates other problems.
> 
> For example: To choose the colors for successive plots, I set up a list:
> 
> rgb = list( [0,0,0], [1,0,0], [0,1,0], [0,0,1], ... );
> 
> and supplied the color to plot using:
> 
>     for i = 1:size( files, 'r' )
>         [ H, tH ] = fscanfMat( files(i), "%lg" );
>         ...
>         plot( a, b, 'color', rgb(i) )
>     end
> 
> but plot2d() requires a *color index*
> 
> So (after trying a bunch of other things) I came up with:
> 
>     rgb = list( color(0,0,0), color(1,0,0), color(0,1,0), color(0,0,1), ... );
> 
>     for i = 1:size( files, 'r' )
>         [ H, tH ] = fscanfMat( files(i), "%lg" );
>         ...
>         plot2d( 'ln', a, b, style = [ rgb(i) ] );
>     end
> 
> which compiles and runs without error, but draws everything in black?
> 
> I need a logflag parameter for plot(); or a sane color(rgb) option for plot2d()?
> 
> Alternatively, insight to whatever magic/error trapping/error control that the plot2d( 'nl' ) flag uses to avoid the singularity problem?
> 
> Cheers, Buk.
> 
> (BTW: I enjoyed reading the bits of your book you pointed me at; and (with your permission) I might ask for a little 'advice' off-list on the subject of friction: aluminium on teflon and the problems of 'creep'. Be warned before you agree. I know next to nothing about friction! )
> 
> 
> > -----Original Message-----
> > From: scilab.browseruk.1ebb8b2ddb.tim#wescottdesign.com at ob.0sg.net
> > Sent: Thu, 31 Mar 2016 17:33:23 -0700
> > To: users at lists.scilab.org
> > Subject: Re: [Scilab-users] Running an .sce from the command line.
> > message 9 (scilab: message 11 of 20) of 20)
> > 
> > 
> > 
> > plot2d (a, b, logflag = "ln")
> > Look at help for plot2d for details.
> > 
> > 
> > Sent from my Verizon Wireless 4G LTE smartphone
> > 
> > -------- Original message --------
> > From: scilab.20.browseruk at xoxy.net
> > Date: 03/31/2016  4:38 PM  (GMT-07:00)
> > To: users at lists.scilab.org
> > Subject: Re: [Scilab-users] Running an .sce from the command line.
> > message 9
> >   of 20)
> > 
> > Samuel,
> > 
> > Thanks. I had to do it in two steps:
> > 
> >     f = gcf();
> >     f.closerequestfcn="exit(0)";
> > 
> > otherwise I get:
> > 
> >     gcf().closerequestfcn="exit(0)";
> >          !--error 2
> >     Invalid factor.
> > 
> > The focus still returns to the command line console pushing the graphics
> > window into the background and meaning I have to go looking for it to see
> > the plot; but when I close it the console exits back to the OS.
> > 
> > Next problem, that should probably be a new thread: How to avoid the
> > Singularity of log function from preventing the script completing if the
> > data contains zeros?
> > 
> > I'm doing:
> > 
> >     plot( log10( a ), b );
> > 
> > To produce the log plot.
> > 
> > 
> > 
> >> -----Original Message-----
> >> From: scilab.browseruk.bb30c473ec.sgougeon#free.fr at ob.0sg.net
> >> Sent: Thu, 31 Mar 2016 21:09:20 +0200
> >> To: users at lists.scilab.org
> >> Subject: Re: [Scilab-users] Running an .sce from the command line.
> >> (scilab: message 9 of 20)
> >> 
> >> Hello,
> >> 
> >> Le 31/03/2016 20:35, scilab.20.browseruk at xoxy.net a écrit :
> >>> Hi,
> >>> 
> >>> I can run my .sce file which produces a graph from a file of data from
> >>> the (windows) command line using:
> >>> 
> > >>      scilex -f myscript.sce filename.rdat
> >>> 
> >>> and that works except:
> >>> 
> >>> Once the plot() executes and the graphic window appears, control and
> >>> focus returns to the interactive command line.
> >> Scilab's console, i guess not the shell terminal.
> >> 
> >>> That's okay; but it'd would be really nice if the focus remained on the
> >>> graphic window until it was closed and then the scilab shell exited
> >>> automatically.
> >> Graphics are not modal: AFAIK it is not possible to lock the console
> >> with a figure until the figure is closed (or until any other event)(you
> >> could use a for loop waiting for an event ; but it won't reject CTRL-C
> >> interruptions).
> >> However, to close automatically Scilab when the figure is closed, you
> >> may add the following in your script:
> >> gcf().closerequestfcn="exit(0)";
> >> 
> >> HTH
> >> Samuel
> >> 
> >> _______________________________________________
> >> users mailing list
> >> users at lists.scilab.org
> >> http://lists.scilab.org/mailman/listinfo/users
> > 
> > ____________________________________________________________
> > Can't remember your password? Do you need a strong and secure password?
> > Use Password manager! It stores your passwords & protects your account.
> > Check it out at http://mysecurelogon.com/manager
> > 
> > 
> > 
> > _______________________________________________
> > users mailing list
> > users at lists.scilab.org
> > http://lists.scilab.org/mailman/listinfo/users
> 
> ____________________________________________________________
> Can't remember your password? Do you need a strong and secure password?
> Use Password manager! It stores your passwords & protects your account.
> Check it out at http://mysecurelogon.com/password-manager
> 
> 
> 
> _______________________________________________
> users mailing list
> users at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users

-- 

Tim Wescott
www.wescottdesign.com
Control & Communications systems, circuit & software design.
Phone: 503.631.7815
Cell:  503.349.8432





More information about the users mailing list