diff options
author | Shashank | 2017-05-29 12:40:26 +0530 |
---|---|---|
committer | Shashank | 2017-05-29 12:40:26 +0530 |
commit | 0345245e860375a32c9a437c4a9d9cae807134e9 (patch) | |
tree | ad51ecbfa7bcd3cc5f09834f1bb8c08feaa526a4 /modules/graphics/demos/matplot | |
download | scilab_for_xcos_on_cloud-0345245e860375a32c9a437c4a9d9cae807134e9.tar.gz scilab_for_xcos_on_cloud-0345245e860375a32c9a437c4a9d9cae807134e9.tar.bz2 scilab_for_xcos_on_cloud-0345245e860375a32c9a437c4a9d9cae807134e9.zip |
CMSCOPE changed
Diffstat (limited to 'modules/graphics/demos/matplot')
-rwxr-xr-x | modules/graphics/demos/matplot/classical.dem.sce | 24 | ||||
-rwxr-xr-x | modules/graphics/demos/matplot/classical_1.dem.sce | 25 | ||||
-rwxr-xr-x | modules/graphics/demos/matplot/java_image.dem.sce | 36 | ||||
-rwxr-xr-x | modules/graphics/demos/matplot/mandelbrot.dem.sce | 101 | ||||
-rwxr-xr-x | modules/graphics/demos/matplot/matplot.dem.gateway.sce | 15 | ||||
-rwxr-xr-x | modules/graphics/demos/matplot/puffin.png | bin | 0 -> 19034 bytes |
6 files changed, 201 insertions, 0 deletions
diff --git a/modules/graphics/demos/matplot/classical.dem.sce b/modules/graphics/demos/matplot/classical.dem.sce new file mode 100755 index 000000000..7960a071a --- /dev/null +++ b/modules/graphics/demos/matplot/classical.dem.sce @@ -0,0 +1,24 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2014 - Scilab Enterprises - Calixte DENIZET +// +// This file is released under the 3-clause BSD license. See COPYING-BSD. + +function demo_classical() + my_handle = scf(100001); + clf(my_handle,"reset"); + demo_viewCode("classical.dem.sce"); + + // DEMO START + + my_plot_desc = _("Classical Matplot"); + my_handle.figure_name = my_plot_desc; + + Matplot(); + + // DEMO END + +endfunction + + +demo_classical(); +clear demo_classical; diff --git a/modules/graphics/demos/matplot/classical_1.dem.sce b/modules/graphics/demos/matplot/classical_1.dem.sce new file mode 100755 index 000000000..b5ea64439 --- /dev/null +++ b/modules/graphics/demos/matplot/classical_1.dem.sce @@ -0,0 +1,25 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2014 - Scilab Enterprises - Calixte DENIZET +// +// This file is released under the 3-clause BSD license. See COPYING-BSD. + +function demo_classical_1() + + my_handle = scf(100001); + clf(my_handle,"reset"); + demo_viewCode("classical_1.dem.sce"); + + // DEMO START + + my_plot_desc = _("Classical Matplot1"); + my_handle.figure_name = my_plot_desc; + + Matplot1(); + + // DEMO END + +endfunction + + +demo_classical_1(); +clear demo_classical_1; diff --git a/modules/graphics/demos/matplot/java_image.dem.sce b/modules/graphics/demos/matplot/java_image.dem.sce new file mode 100755 index 000000000..7e0ae7430 --- /dev/null +++ b/modules/graphics/demos/matplot/java_image.dem.sce @@ -0,0 +1,36 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2014 - Scilab Enterprises - Calixte DENIZET +// +// This file is released under the 3-clause BSD license. See COPYING-BSD. + +function demo_java_image() + my_handle = scf(100001); + clf(my_handle,"reset"); + demo_viewCode("java_image.dem.sce"); + demopath = get_absolute_file_path("java_image.dem.sce"); + + // DEMO START + + my_plot_desc = _("Java Image"); + my_handle.figure_name = my_plot_desc; + + jimport javax.imageio.ImageIO; + jimport java.net.URL; + + bi = ImageIO.read(URL.new("file:////" + demopath + "/puffin.png")); + w = bi.getWidth(jvoid); + h = bi.getHeight(jvoid); + data = bi.getRGB(0, 0, w, h, [], 0, w); + data = matrix(data, double(w), double(h)); + data = uint32(data'); + + Matplot(data); + e = gce(); + e.image_type="argb"; + + // DEMO END +endfunction + + +demo_java_image(); +clear demo_java_image;
\ No newline at end of file diff --git a/modules/graphics/demos/matplot/mandelbrot.dem.sce b/modules/graphics/demos/matplot/mandelbrot.dem.sce new file mode 100755 index 000000000..a265f89e6 --- /dev/null +++ b/modules/graphics/demos/matplot/mandelbrot.dem.sce @@ -0,0 +1,101 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2012 - Samuel GOUGEON +// +// This file is released under the 3-clause BSD license. See COPYING-BSD. + +function demo_mandelbrot() + + my_handle = scf(100001); + clf(my_handle,"reset"); + + // DEMO START + + my_plot_desc = "mandelbrot"; + my_handle.figure_name = my_plot_desc; + function M = getMandelbrotPart(xmin, xmax, ymin, ymax, nbPix, nColors, maxIters) + // M : matrix of integers imaging the targetted local Mandelbrot area + // M(i,j) gives the number of iterations for which the iterated z(i,j) + // suite crosses |z|>=2 (making this point out of the Mandelbrot set) + ndmin = 0; + Dx = abs(xmax - xmin); + Dy = abs(ymax - ymin); + dp = sqrt(Dx*Dy / nbPix); // Area of a pixel + nx = round(Dx/dp); + ny = round(Dy/dp); + dx = abs(xmax - xmin)/(nx-1); + x = linspace(xmin, xmax, nx); + y = ymax:-dx:ymin; + ny = length(y); + c = (ones(ny,1)*x) + %i*(y.'*ones(1,nx)); + z = c; // Initial c Matrix + nd = ones(z)*%inf; // nb iter for > 2 + inC = 1:size(c,"*"); + i = 1; + waitId = 0; + ifin = min(ndmin+nColors, maxIters); + while i<=ifin, + if waitId==0 + waitId = waitbar(i/ifin,_("Computing in progress...")); + else + waitbar(i/ifin,waitId); + end + a = abs(z); + nd(inC(find(a>2)))=i; + tmp = find(a<=2); + z = z(tmp); + inC = inC(tmp); + z = z.*z+c(inC); + i = i+1; + end + close(waitId) + M = nd + endfunction + // --------------------- + + nColors = 100; // Number of colors + maxIters = 500; // Maximal number of iterations + nbPix = 200000; // Total number of pixel per image + // Targetted Mandelbrot area + xmin = -0.33; + xmax = 0.07; + ymin = 0.6; + ymax = 1.13; + + // Generating the Mandelbrot local view + M = getMandelbrotPart(xmin, xmax, ymin, ymax, nbPix, nColors, maxIters); + + // Scaling false colors + icol = [color("black") addcolor(rainbowcolormap(nColors))]; + Mmin = min(M); + M = M - Mmin + 1; + M(find(M==%inf | M>nColors))=0; + A = icol(M+1); + + clf + drawlater; + // colordef("black") // Bug 11369 to be fixed + + // Displaying the area + Matplot1(matrix(A,size(M)),[xmin ymin xmax ymax]); + + // Post-tuning the graphics + ca = gca(); + ca.isoview = "on"; + ca.data_bounds = [xmin ymin ; xmax ymax]; + ca.tight_limits = "on"; + ca.axes_visible = ["on" "on" "off"]; + ca.title.font_size = 2; + Ttxt = _("Matplot1(..) displays a matrix\n(value => color#), with SCALED AXES\n(here is a part of the Mandelbrot set)") + xtitle(justify(msprintf(Ttxt),"c")) + xlabel(_("Real part")) + ylabel(_("Imaginary part")) + + drawnow() + + demo_viewCode("mandelbrot.dem.sce"); + +endfunction + +demo_mandelbrot(); +clear demo_mandelbrot; + diff --git a/modules/graphics/demos/matplot/matplot.dem.gateway.sce b/modules/graphics/demos/matplot/matplot.dem.gateway.sce new file mode 100755 index 000000000..3017a80bb --- /dev/null +++ b/modules/graphics/demos/matplot/matplot.dem.gateway.sce @@ -0,0 +1,15 @@ +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2014 - Scilab Enterprises - Calixte DENIZET +// +// This file is released under the 3-clause BSD license. See COPYING-BSD. + +demopath = get_absolute_file_path("matplot.dem.gateway.sce"); + +subdemolist = [ .. +_("Classical Matplot") , "classical.dem.sce" ; .. +_("Classical Matplot1") , "classical_1.dem.sce" ; .. +_("Mandelbrot") , "mandelbrot.dem.sce" ; .. +_("Java Image") , "java_image.dem.sce" ]; + +subdemolist(:,2) = demopath + subdemolist(:,2); +clear demopath;
\ No newline at end of file diff --git a/modules/graphics/demos/matplot/puffin.png b/modules/graphics/demos/matplot/puffin.png Binary files differnew file mode 100755 index 000000000..cf2e6716c --- /dev/null +++ b/modules/graphics/demos/matplot/puffin.png |