<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>Hi Tim,<br><br>There are situations where one may want to arbitrarily zoom a plot interactively.<br><br>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.<br><br>I copy below acode sample from that thread, fyi, which explodes Scilab for a plot scale= 1 / 20:<br><br><pre style="font-family:Monospaced;font-style:normal;font-size:16.0;"><span style="color:rgb(100,174,100);font-style:italic;">// Code adapted from Serge Steer</span><span style="color:rgb(100,174,100);font-style:italic;">'</span><span style="color:rgb(100,174,100);font-style:italic;">s script:</span>
<span style="color:rgb(174,92,176);text-decoration:underline;">clf</span><span style="color:rgb(0,0,0);">;</span>
<span style="color:rgb(174,92,176);text-decoration:underline;">plot</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(174,92,176);text-decoration:underline;">linspace</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,143,143);">0</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(188,143,143);">100</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(188,143,143);">10</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(174,92,176);text-decoration:underline;">linspace</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,143,143);">0</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(188,143,143);">150</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(188,143,143);">10</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(74,85,219);">)</span>
<span style="color:rgb(0,0,0);">fig</span><span style="color:rgb(92,92,92);">=</span> <span style="color:rgb(174,92,176);text-decoration:underline;">gcf</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">;</span>
<span style="color:rgb(0,0,0);">ax</span><span style="color:rgb(92,92,92);">=</span> <span style="color:rgb(174,92,176);text-decoration:underline;">gca</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">;</span>
<span style="color:rgb(0,0,0);">ax</span><span style="color:rgb(92,92,92);">.</span><span style="color:rgb(170,170,170);">tight_limits</span><span style="color:rgb(92,92,92);">=</span> <span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">on</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(0,0,0);">;</span>
<span style="color:rgb(100,174,100);font-style:italic;">//Dimensions of the axis in user coordinates</span>
<span style="color:rgb(0,0,0);">ax_xu</span><span style="color:rgb(92,92,92);">=</span> <span style="color:rgb(0,0,0);">ax</span><span style="color:rgb(92,92,92);">.</span><span style="color:rgb(170,170,170);">data_bounds</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,143,143);">2</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(188,143,143);">1</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(92,92,92);">-</span><span style="color:rgb(0,0,0);">ax</span><span style="color:rgb(92,92,92);">.</span><span style="color:rgb(170,170,170);">data_bounds</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,143,143);">1</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(188,143,143);">1</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">;</span>
<span style="color:rgb(0,0,0);">ax_yu</span><span style="color:rgb(92,92,92);">=</span> <span style="color:rgb(0,0,0);">ax</span><span style="color:rgb(92,92,92);">.</span><span style="color:rgb(170,170,170);">data_bounds</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,143,143);">2</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(188,143,143);">2</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(92,92,92);">-</span><span style="color:rgb(0,0,0);">ax</span><span style="color:rgb(92,92,92);">.</span><span style="color:rgb(170,170,170);">data_bounds</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,143,143);">1</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(188,143,143);">2</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">;</span>
<span style="color:rgb(100,174,100);font-style:italic;">//pixel size in mm to be determined according to screen size and resolution (dpi)</span>
<span style="color:rgb(0,0,0);">dpi</span><span style="color:rgb(92,92,92);">=</span> <span style="color:rgb(188,143,143);">90</span><span style="color:rgb(0,0,0);">;</span> <span style="color:rgb(100,174,100);font-style:italic;">// dots per inch (depending on screen resolution)</span>
<span style="color:rgb(0,0,0);">px</span><span style="color:rgb(92,92,92);">=</span> <span style="color:rgb(188,143,143);">2.54e-2</span><span style="color:rgb(92,92,92);">/</span><span style="color:rgb(0,0,0);">dpi</span><span style="color:rgb(0,0,0);">;</span><span style="color:rgb(100,174,100);font-style:italic;">//conversion from pixel to meter</span>
<span style="color:rgb(100,174,100);font-style:italic;">//py= 2.54e-2/dpi;//conversion from pixel to meter</span>
<span style="color:rgb(50,185,185);">printf</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">\nSetting scale=1/500 is fine but scale=1/20 crashes Scilab 5.4.1 in Win 7\n</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">;</span>
<span style="color:rgb(0,0,0);">scale</span><span style="color:rgb(92,92,92);">=</span> <span style="color:rgb(174,92,176);text-decoration:underline;">input</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">ENTER scale = </span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">;</span>
<span style="color:rgb(100,174,100);font-style:italic;">// scale= 1/200; // OK</span>
<span style="color:rgb(100,174,100);font-style:italic;">// scale= 1/20; // Scilab aborts (Win 7) as window is larger than screen!</span>
<span style="color:rgb(100,174,100);font-style:italic;">//Dimension of the axis in pixels </span>
<span style="color:rgb(0,0,0);">ax_xp</span><span style="color:rgb(92,92,92);">=</span> <span style="color:rgb(0,0,0);">ax_xu</span><span style="color:rgb(92,92,92);">/</span><span style="color:rgb(0,0,0);">px</span><span style="color:rgb(92,92,92);">*</span><span style="color:rgb(0,0,0);">scale</span><span style="color:rgb(0,0,0);">;</span>
<span style="color:rgb(100,174,100);font-style:italic;">//ax_yp= ax_yu/py;</span>
<span style="color:rgb(100,174,100);font-style:italic;">//Dimension of the current portion of the canvas in pixels</span>
<span style="color:rgb(0,0,0);">ax_Wp</span><span style="color:rgb(92,92,92);">=</span> <span style="color:rgb(0,0,0);">ax_xp</span><span style="color:rgb(92,92,92);">/</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,143,143);">1</span><span style="color:rgb(92,92,92);">-</span><span style="color:rgb(50,185,185);">sum</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(0,0,0);">ax</span><span style="color:rgb(92,92,92);">.</span><span style="color:rgb(170,170,170);">margins</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,143,143);">1</span><span style="color:rgb(255,170,0);">:</span><span style="color:rgb(188,143,143);">2</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">;</span>
<span style="color:rgb(100,174,100);font-style:italic;">//ax_Hp= ax_yp/(1-sum(ax.margins(3:4)));</span>
<span style="color:rgb(100,174,100);font-style:italic;">//Canvas dimensions in pixels</span>
<span style="color:rgb(0,0,0);">fig_Wp</span><span style="color:rgb(92,92,92);">=</span> <span style="color:rgb(0,0,0);">ax_Wp</span><span style="color:rgb(92,92,92);">/</span><span style="color:rgb(0,0,0);">ax</span><span style="color:rgb(92,92,92);">.</span><span style="color:rgb(170,170,170);">axes_bounds</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,143,143);">3</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">;</span>
<span style="color:rgb(100,174,100);font-style:italic;">//fig_Hp=ax_Hp/ax.axes_bounds(4);</span>
<span style="color:rgb(0,0,0);">fig_Hp</span><span style="color:rgb(92,92,92);">=</span><span style="color:rgb(0,0,0);">ax_yu</span><span style="color:rgb(0,0,0);">;</span>
<span style="color:rgb(100,174,100);font-style:italic;">// Samuel Gougeon</span><span style="color:rgb(100,174,100);font-style:italic;">'</span><span style="color:rgb(100,174,100);font-style:italic;">s tip:</span>
<span style="color:rgb(0,0,0);">fig</span><span style="color:rgb(92,92,92);">.</span><span style="color:rgb(170,170,170);">auto_resize</span> <span style="color:rgb(92,92,92);">=</span> <span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">off</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(0,0,0);">;</span>
<span style="color:rgb(100,174,100);font-style:italic;">//Set fig.axes_size property to have </span>
<span style="color:rgb(0,0,0);">fig</span><span style="color:rgb(92,92,92);">.</span><span style="color:rgb(170,170,170);">axes_size</span><span style="color:rgb(92,92,92);">=</span><span style="color:rgb(74,85,219);">[</span><span style="color:rgb(0,0,0);">fig_Wp</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(0,0,0);">fig_Hp</span><span style="color:rgb(74,85,219);">]</span><span style="color:rgb(0,0,0);">;</span></pre><br><br>Regards,<br><br>Rafael<br><br><br><div>> From: tim@wescottdesign.com<br>> To: users@lists.scilab.org<br>> Date: Wed, 22 Apr 2015 09:04:01 -0700<br>> Subject: Re: [Scilab-users] Display problem<br>> <br>> On Wed, 2015-04-22 at 06:07 +0000, SCHULZ Wolfgang wrote:<br>> > Hello,<br>> > I would like to display 10e6 points but it seems that Scilab (5.2.2 x64 on Win7) works only till 8e6 points.<br>> > <br>> > I tried increasing the Java Heap memory (and restarted Scilab afterwards) but there was no effect.<br>> > <br>> > Here is a test program what works till 8e6 but doesn't work for 9e6.<br>> > <br>> > stacksize('max')<br>> > Maximum=8e6<br>> > dt=1/Maximum;<br>> > t=0:dt:1;<br>> > y=sin(2*%pi*50*t);<br>> > plot(t,y);<br>> > <br>> > Any idea what could be wrong?<br>> <br>> While you're waiting to get the bug fixed, have you pondered the<br>> impossibility of displaying X values in Y spaces when X >> Y? Unless<br>> you've got something astonishing, your display has, at most, only a few<br>> thousand pixels across, so there's no way you can display 10e6 points<br>> anyway. The same holds for any normal page-sized sheet and printer<br>> (although I suppose you could manage this with a 300mm silicon blank and<br>> some state-of-the-art lithography).<br>> <br>> If your function is continuous, then doing<br>> <br>> plot(t(1:100:$), y(1:100:$))<br>> <br>> will give you a pretty close approximation, and still use way more<br>> points than your display can handle. If you're looking for glitches<br>> then you'll have to do something fancier (and more challenging as far as<br>> memory usage).<br>> <br>> -- <br>> <br>> Tim Wescott<br>> www.wescottdesign.com<br>> Control & Communications systems, circuit & software design.<br>> Phone: 503.631.7815<br>> Cell: 503.349.8432<br>> <br>> _______________________________________________<br>> users mailing list<br>> users@lists.scilab.org<br>> http://lists.scilab.org/mailman/listinfo/users<br></div> </div></body>
</html>