Re: [Scilab-users] Problem graypolarplot

2016-03-11 Thread SCHULZ Wolfgang
Hello,
thanks this basically solves my problems with the presentation to north. I'm 
using Scilab 5.5.2 Win7 64 bit (sorry forgot to mention that in my original 
email) and the examples in my first email are according to the graypolarplot 
help page (graypolarplot(theta,rho,z,[strf,rect])). Maybe a bug in the help?

I still have some issues:
- As with the original function no data is displayed in the inner ring (see 
attached image 0-100km). The matrix contains 5x24 values but it seems not all 
of them are displayed. Is this a bug or am I doing something wrong?
- How do I tell the plot to colorize only values in a certain range? E.g. 
values are ranging from 20 to 140 and I want to colorize only from 50 to 150 
from blue to red (jetcolormap).

Thanks for your help
Wolfgang




> -Ursprüngliche Nachricht-
> Von: users [mailto:users-boun...@lists.scilab.org] Im Auftrag von Serge Steer
> Gesendet: Freitag, 11. März 2016 10:59
> An: Users mailing list for Scilab
> Betreff: Re: [Scilab-users] Problem graypolarplot
> 
> Sorry the file attached in my previous mail contains a forgotten pause
> instruction
> 
> Le 11/03/2016 09:52, SCHULZ Wolfgang a écrit :
> > Hello,
> > I have problems using the options of graypolarplot The following basic
> > function is working:
> > graypolarplot(theta,rho,Gain_plot')
> >
> > But if I want to use some options I get an error message. The following
> examples produce error messages:
> > graypolarplot(theta,rho,Gain_plot',strf="030",rect=[-20,-20,20,20])
> > graypolarplot(theta,rho,Gain_plot',"020",[-500,-500,500,500])
> > graypolarplot(theta,rho,Gain_plot',"030")
> 
> How to use those examples?
> 
> These was old options. With current Scilab version if you want to change the
> data bounds (rect) you can modify the data_bounds property of the axes
> 
> graypolarplot(theta,rho,Gain_plot')
> ax=gca(); //get the handle on the currect axes
> ax.data_bounds=[-20 -20;20 20].
> 
> > Another question would be - is it possible to have 0° in the direction of 
> > the
> positive y-axis (North) and maybe the direction of the angle clockwise?
> Please find attached a ffunction which realizes what you want.
> > Thanks for your help
> > Wolfgang
> > ___
> > users mailing list
> > users@lists.scilab.org
> > http://lists.scilab.org/mailman/listinfo/users
> 

___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Problem graypolarplot

2016-03-11 Thread Serge Steer
Sorry the file attached in my previous mail contains a forgotten pause 
instruction


Le 11/03/2016 09:52, SCHULZ Wolfgang a écrit :

Hello,
I have problems using the options of graypolarplot
The following basic function is working:
graypolarplot(theta,rho,Gain_plot')

But if I want to use some options I get an error message. The following 
examples produce error messages:
graypolarplot(theta,rho,Gain_plot',strf="030",rect=[-20,-20,20,20])
graypolarplot(theta,rho,Gain_plot',"020",[-500,-500,500,500])
graypolarplot(theta,rho,Gain_plot',"030")


How to use those examples?

These was old options. With current Scilab version if you want to change 
the data bounds (rect) you can modify the data_bounds property of the axes


graypolarplot(theta,rho,Gain_plot')
ax=gca(); //get the handle on the currect axes
ax.data_bounds=[-20 -20;20 20].


Another question would be - is it possible to have 0° in the direction of the 
positive y-axis (North) and maybe the direction of the angle clockwise?

Please find attached a ffunction which realizes what you want.

Thanks for your help
Wolfgang
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users



// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
// Copyright (C) INRIA
// Copyright (C) Samuel GOUGEON - 2013 : vectorization, code style
//
// This file must be used under the terms of the CeCILL.
// This source file is licensed as described in the file COPYING, which
// you should have received as part of this distribution.  The terms
// are also available at
// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt


function graypolarplot(theta,rho,z,varargin)
function c=Cos(x),c=cos(-x+%pi/2);endfunction
function s=Sin(x),s=sin(-x+%pi/2);endfunction

[lhs,rhs] = argn(0)
if rhs<=0 then
rho = 1:0.2:4
theta = (0:0.02:1)*2*%pi
z = 30+round(theta'*(1+rho.^2))
clf()
f = gcf()
f.color_map = hotcolormap(128)
f.background= 128
a = gca()
a.background = 128
a.foreground = 1
graypolarplot(theta,rho,z)
return
end

if rhs<3 then
error(msprintf(gettext("%s: Wrong number of input argument(s): At least 
%d expected.\n"), "graypolarplot", 3));
end

R = max(rho)
nv = size(varargin)
if nv>=1
strf = varargin(2)
else
strf = "030"
end
if nv>=2
rect = varargin(4)
else
rect = [-R -R R R]*1.1
end

// drawlater
fig = gcf();
immediate_drawing = fig.immediate_drawing;
fig.immediate_drawing = "off";

axes = gca();
axes.data_bounds = [rect(1), rect(2); rect(3), rect(4)];
axes.clip_state = "clipgrf";

drawGrayplot(theta,rho,z);

objectList = gce(); // get all the created objects to glue them at the end.

axes.isoview = "on";
axes.box = "off";
axes.axes_visible = ["off","off","off"];
axes.x_label.text = "";
axes.y_label.text = "";
axes.z_label.text = "";

step = R/5
r  = step;
dr = 0.02*r;
for k = 1:4
xarc(-r, r, 2*r, 2*r, 0, 360*64)
objectList($ + 1) = gce();
arc = gce();
arc.line_style = 3;
xstring((r+dr)*Cos(5*%pi/12),(r+dr)*Sin(5*%pi/12), 
string(round(10*r)/10))
objectList($ + 1) = gce();
r=r+step
end
xarc(-r,r,2*r,2*r,0,360*64)
objectList($ + 1) = gce();
xstring((r+dr)*Cos(5*%pi/12),(r+dr)*Sin(5*%pi/12), string(round(10*r)/10))
objectList($ + 1) = gce();

rect = xstringl(0,0,"360");
w = rect(3);
h = rect(4);
r = R*1.05
for k = 0:11
xsegs([0 ; R*Cos(k*(%pi/6))],[0 ; R*Sin(k*(%pi/6))])
objectList($ + 1) = gce();
arc = gce();
arc.line_style = 4;
xstring((r+w/2)*Cos(k*(%pi/6))-w/2, 
(r+h/2)*Sin(k*(%pi/6))-h/2,string(k*30))
objectList($ + 1) = gce();
end

// glue all the created objects
glue(objectList);

// drawnow
fig.immediate_drawing = immediate_drawing;

endfunction
// ---

function [x,y] = polar2Cart(rho, theta)
x = rho * Cos(theta);
y = rho * Sin(theta);
endfunction
// ---

function [nbDecomp] = computeNeededDecompos(theta)
// Compute the needed decomposition for each patch

// minimal decompostion for each ring
nbFactesPerRingMin = 512;

nbDecomp = ceil(nbFactesPerRingMin / size(theta, "*"));

endfunction
// ---
function drawGrayplot(theta, rho, z)
// draw only the colored part of the grayplot

// the aim of the function is to draw a set of curved facets
// In previous versions, it used arcs to perform this.
// However, since arcs are drawn from the origin to the outside
// there were overlapping and cause Z fighting 

Re: [Scilab-users] Problem graypolarplot

2016-03-11 Thread Serge Steer

Le 11/03/2016 09:52, SCHULZ Wolfgang a écrit :

Hello,
I have problems using the options of graypolarplot
The following basic function is working:
graypolarplot(theta,rho,Gain_plot')

But if I want to use some options I get an error message. The following 
examples produce error messages:
graypolarplot(theta,rho,Gain_plot',strf="030",rect=[-20,-20,20,20])
graypolarplot(theta,rho,Gain_plot',"020",[-500,-500,500,500])
graypolarplot(theta,rho,Gain_plot',"030")


How to use those examples?

These was old options. With current Scilab version if you want to change 
the data bounds (rect) you can modify the data_bounds property of the axes


graypolarplot(theta,rho,Gain_plot')
ax=gca(); //get the handle on the currect axes
ax.data_bounds=[-20 -20;20 20].


Another question would be - is it possible to have 0° in the direction of the 
positive y-axis (North) and maybe the direction of the angle clockwise?

Please find attached a ffunction which realizes what you want.

Thanks for your help
Wolfgang
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
// Copyright (C) INRIA
// Copyright (C) Samuel GOUGEON - 2013 : vectorization, code style
//
// This file must be used under the terms of the CeCILL.
// This source file is licensed as described in the file COPYING, which
// you should have received as part of this distribution.  The terms
// are also available at
// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt


function graypolarplot(theta,rho,z,varargin)
function c=Cos(x),c=cos(-x+%pi/2);endfunction
function s=Sin(x),s=sin(-x+%pi/2);endfunction

[lhs,rhs] = argn(0)
if rhs<=0 then
rho = 1:0.2:4
theta = (0:0.02:1)*2*%pi
z = 30+round(theta'*(1+rho.^2))
clf()
f = gcf()
f.color_map = hotcolormap(128)
f.background= 128
a = gca()
a.background = 128
a.foreground = 1
graypolarplot(theta,rho,z)
return
end

if rhs<3 then
error(msprintf(gettext("%s: Wrong number of input argument(s): At least 
%d expected.\n"), "graypolarplot", 3));
end

pause
R = max(rho)
nv = size(varargin)
if nv>=1
strf = varargin(2)
else
strf = "030"
end
if nv>=2
rect = varargin(4)
else
rect = [-R -R R R]*1.1
end

// drawlater
fig = gcf();
immediate_drawing = fig.immediate_drawing;
fig.immediate_drawing = "off";

axes = gca();
axes.data_bounds = [rect(1), rect(2); rect(3), rect(4)];
axes.clip_state = "clipgrf";

drawGrayplot(theta,rho,z);

objectList = gce(); // get all the created objects to glue them at the end.

axes.isoview = "on";
axes.box = "off";
axes.axes_visible = ["off","off","off"];
axes.x_label.text = "";
axes.y_label.text = "";
axes.z_label.text = "";

step = R/5
r  = step;
dr = 0.02*r;
for k = 1:4
xarc(-r, r, 2*r, 2*r, 0, 360*64)
objectList($ + 1) = gce();
arc = gce();
arc.line_style = 3;
xstring((r+dr)*Cos(5*%pi/12),(r+dr)*Sin(5*%pi/12), 
string(round(10*r)/10))
objectList($ + 1) = gce();
r=r+step
end
xarc(-r,r,2*r,2*r,0,360*64)
objectList($ + 1) = gce();
xstring((r+dr)*Cos(5*%pi/12),(r+dr)*Sin(5*%pi/12), string(round(10*r)/10))
objectList($ + 1) = gce();

rect = xstringl(0,0,"360");
w = rect(3);
h = rect(4);
r = R*1.05
for k = 0:11
xsegs([0 ; R*Cos(k*(%pi/6))],[0 ; R*Sin(k*(%pi/6))])
objectList($ + 1) = gce();
arc = gce();
arc.line_style = 4;
xstring((r+w/2)*Cos(k*(%pi/6))-w/2, 
(r+h/2)*Sin(k*(%pi/6))-h/2,string(k*30))
objectList($ + 1) = gce();
end

// glue all the created objects
glue(objectList);

// drawnow
fig.immediate_drawing = immediate_drawing;

endfunction
// ---

function [x,y] = polar2Cart(rho, theta)
x = rho * Cos(theta);
y = rho * Sin(theta);
endfunction
// ---

function [nbDecomp] = computeNeededDecompos(theta)
// Compute the needed decomposition for each patch

// minimal decompostion for each ring
nbFactesPerRingMin = 512;

nbDecomp = ceil(nbFactesPerRingMin / size(theta, "*"));

endfunction
// ---
function drawGrayplot(theta, rho, z)
// draw only the colored part of the grayplot

// the aim of the function is to draw a set of curved facets
// In previous versions, it used arcs to perform this.
// However, since arcs are drawn from the origin to the outside
// there were overlapping and cause Z fighting in 3D.
// Consequenlty we now decompose each curved facet into a set of