[Scilab-users] Display problem

Rafael Guerra jrafaelbguerra at hotmail.com
Wed Apr 22 19:00:58 CEST 2015


Hi Tim,

There are situations where one may want to arbitrarily zoom a plot interactively.

This leads me to a past email thread "Scaled plot displays in Scilab?" where there was a possible Java heap limitation. This has important industrial applications.

I copy below acode sample from that thread, fyi, which explodes Scilab for a plot scale= 1 / 20:

// Code adapted from Serge Steer's script:
clf;
plot(linspace(0,100,10),linspace(0,150,10))
 
fig= gcf();
ax= gca();
ax.tight_limits= "on";
 
//Dimensions of the axis in user coordinates
ax_xu= ax.data_bounds(2,1)-ax.data_bounds(1,1);
ax_yu= ax.data_bounds(2,2)-ax.data_bounds(1,2);
 
//pixel size in mm to be determined according to screen size and resolution (dpi)
dpi= 90; // dots per inch (depending on screen resolution)
px= 2.54e-2/dpi;//conversion from pixel to meter
//py= 2.54e-2/dpi;//conversion from pixel to meter
printf("\nSetting scale=1/500 is fine but scale=1/20 crashes Scilab 5.4.1 in Win 7\n");
scale= input("ENTER scale = ");
// scale= 1/200;  // OK
// scale= 1/20;   // Scilab aborts (Win 7) as window is larger than screen!
 
//Dimension of the axis in pixels 
ax_xp= ax_xu/px*scale;
//ax_yp= ax_yu/py;
 
//Dimension of the current portion of the canvas in pixels
ax_Wp= ax_xp/(1-sum(ax.margins(1:2)));
//ax_Hp= ax_yp/(1-sum(ax.margins(3:4)));
 
//Canvas dimensions in pixels
fig_Wp= ax_Wp/ax.axes_bounds(3);
//fig_Hp=ax_Hp/ax.axes_bounds(4);
fig_Hp=ax_yu;
 
// Samuel Gougeon's tip:
fig.auto_resize = "off";
 
//Set fig.axes_size property to have 
fig.axes_size=[fig_Wp,fig_Hp];

Regards,

Rafael


> From: tim at wescottdesign.com
> To: users at lists.scilab.org
> Date: Wed, 22 Apr 2015 09:04:01 -0700
> Subject: Re: [Scilab-users] Display problem
> 
> On Wed, 2015-04-22 at 06:07 +0000, SCHULZ Wolfgang wrote:
> > Hello,
> > I would like to display 10e6 points but it seems that Scilab (5.2.2 x64 on Win7) works only till 8e6 points.
> > 
> > I tried increasing the Java Heap memory (and restarted Scilab afterwards) but there was no effect.
> > 
> > Here is a test program what works till 8e6 but doesn't work for 9e6.
> > 
> > stacksize('max')
> > Maximum=8e6
> > dt=1/Maximum;
> > t=0:dt:1;
> > y=sin(2*%pi*50*t);
> > plot(t,y);
> > 
> > Any idea what could be wrong?
> 
> While you're waiting to get the bug fixed, have you pondered the
> impossibility of displaying X values in Y spaces when X >> Y?  Unless
> you've got something astonishing, your display has, at most, only a few
> thousand pixels across, so there's no way you can display 10e6 points
> anyway.  The same holds for any normal page-sized sheet and printer
> (although I suppose you could manage this with a 300mm silicon blank and
> some state-of-the-art lithography).
> 
> If your function is continuous, then doing
> 
> plot(t(1:100:$), y(1:100:$))
> 
> will give you a pretty close approximation, and still use way more
> points than your display can handle.  If you're looking for glitches
> then you'll have to do something fancier (and more challenging as far as
> memory usage).
> 
> -- 
> 
> Tim Wescott
> www.wescottdesign.com
> Control & Communications systems, circuit & software design.
> Phone: 503.631.7815
> Cell:  503.349.8432
> 
> _______________________________________________
> users mailing list
> users at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20150422/118371f3/attachment.htm>


More information about the users mailing list