Re: [Scilab-users] more polarplots in one coordinate system

2016-11-28 Thread Maxi041291
Hey Samuel Gaugeon, 
i would like to have arrows in different colors.

I try to show the influence of modes on the answer of my structure. In the
beginning of my code iam asking how many modes the user would like to see.
This is what i meant with fixed (sorry for the vocab.)

what do you mean with this?
"Anyway, you must call polarplot() only once. Or to convert (angles,radii)
=> (x, y) yourself before using plot() instead of polarplot()"

Hey Tim Wescott, 
the problem is, that you have the same amplitude. If you zoom in, you see
two different angle axis. 

Hey Serge Steer, 
i cant find a new command named polarplot1. But it would be nice if there
would be one.



Can i also write a string in a for loop and put it into the input of
polarplot?
I mean a string like: 
[phase(1:2) phase(2:3) phase(3:4) phase(4:5) phase(5:6)
allphase],[magnitude(1:2) magnitude(2:3) magnitude(3:4) magnitude(4:5)
magnitude(5:6) allmagnitude],[5,2,3,1,4,9]
Is that possible?




--
View this message in context: 
http://mailinglists.scilab.org/more-polarplots-in-one-coordinate-system-tp4035127p4035134.html
Sent from the Scilab users - Mailing Lists Archives mailing list archive at 
Nabble.com.
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] more polarplots in one coordinate system

2016-11-28 Thread Serge Steer
Please find attached a new polarplot1 function which is able to do what 
you want (some refinements may have to be done)


Example (sequences of polar plots)

phase=[0;-2.8487;-2.993; 2.9664;2.8264;2.9638];
magnitude=[0;1.25e-4;2.17e-4;1.34e-4;7.5e-5;1.32e-4];
allmagnitude=[0; 1.32e-4];
allphase=[0;2.9638];
colors=[5,2,3,1,4,9];
clf
for k=1:size(phase,"*")-1
  polarplot1(phase(k:k+1),magnitude(k:k+1),colors(k))
end
polarplot1(allphase,allmagnitude,colors(6))

Example (many plots with a simple call)

clf;
phi=[];mag=[];
for k=1:size(phase,"*")-1
  phi=[phi phase(k:k+1)];
  mag=[mag magnitude(k:k+1)];
end
phi=[phi allphase];
mag=[mag allmagnitude];
polarplot1(phi,mag,colors)



Le 28/11/2016 à 16:01, Maxi041291 a écrit :

Thank you for trying to help, but i think i didnt describe my Problem well
enough.
Normally there should be arrows in the plot, but i dont think this is
possible in scilab.

But here a Piece of my original code in scilab:


clear;
clc;
phase=[0;-2.8487;-2.993; 2.9664;2.8264;2.9638];
magnitude=[0;1.25e-4;2.17e-4;1.34e-4;7.5e-5;1.32e-4];
allmagnitude=[0; 1.32e-4];
allphase=[0;2.9638];
//This is how it works, but just for a defined length of the vectors
clf(1);
polarplot([phase(1:2) phase(2:3) phase(3:4) phase(4:5) phase(5:6)
allphase],[magnitude(1:2) magnitude(2:3) magnitude(3:4) magnitude(4:5)
magnitude(5:6) allmagnitude],[5,2,3,1,4,9]);

//This is the way it doesnt work
clf(2);
polarplot(phase,magnitude,[5,2]);
polarplot(allphase,allmagnitude,[1,2]);




Because the length of the vectors (Magnitude and Phase) is not fixed in my
original code, i think i cant define the polarplot like its done in the
first example.
So i would like to do it like in the second example, but that doesn´t work,
because i get a new axis for each datapoint
  





--
View this message in context: 
http://mailinglists.scilab.org/more-polarplots-in-one-coordinate-system-tp4035127p4035130.html
Sent from the Scilab users - Mailing Lists Archives mailing list archive at 
Nabble.com.
___
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) 2010 - DIGITEO - Manuel Juliachs
// Copyright (C) 2012 - 2016 - Scilab Enterprises
//
// This file is hereby licensed under the terms of the GNU GPL v2.0,
// pursuant to article 5.3.4 of the CeCILL v.2.1.
// This file was originally licensed under the terms of the CeCILL v2.1,
// and continues to be available under such terms.
// For more information, see the COPYING file which you should have received
// along with this program.

function polarplot1(theta,rho,style)
[lhs,rhs]=argn(0)

if rhs<=0 then
theta=0:.01:2*%pi;
rho=sin(2*theta).*cos(2*theta)
clf();
polarplot(theta,rho)
return
end
if size(theta,1)==1 then
theta=theta(:),
end
if size(rho,1)==1 then
rho=rho(:),
end
 
rm=max(abs(rho))
x=rho.*cos(theta)
y=rho.*sin(theta)
xmin=min(x);
xmax=max(x);
ymin=min(y);
ymax=max(y);

drawlater()
a=gca();
if a.tag=="polarplot" then 
  //clear grid
  delete(a.user_data.grid);
  bnds=a.user_data.bounds
  xmin=min(bnds(1),xmin)
  xmax=max(bnds(2),xmax)
  ymin=min(bnds(3),ymin)
  ymax=max(bnds(4),ymax)
  rm=max(bnds(5),rm)
end
   
  
  
   
polargrid(xmin,xmax,ymin,ymax,rm)
for k=1:size(theta,2)
  xpoly(x(:,k),y(:,k))
  e=gce();
  e.foreground=style(k)
end
drawnow()
endfunction

function polargrid(xmin,xmax,ymin,ymax,rm)
// Some default values:
  Amin=0 // starting angle for the frame
  dA=360 // span of the angular frame
  nn=4// number of quadrants to be drawn
  
  // Angle at which Radial labels will be displayed
  A=round(atan((ymin+ymax)/2,(xmin+xmax)/2)/%pi*180/45)*45;
  dx=-0.5, dy=-0.5  // H & V shifts in string-width and string-height units
  L=(xmax-xmin)*1.07;
  H=(ymax-ymin)*1.07;
  
  //determine Qudrants to be drawn
  Q=[%T %T %T %T];
  e=rm/500;

  if xmin<-e then
xmin=-rm;
  else
xmin=0; Q([2 3])=%F;
  end

  if xmax>e then
xmax= rm;
  else
xmax=0; Q([1 4])=%F;
  end

  if ymin<-e then
ymin=-rm;
  else
ymin=0; Q([3 4])=%F;
  end

  if ymax>e then
ymax= rm;
  else
ymax=0; Q([1 2])=%F;
  end

  L=(xmax-xmin)*1.1; if L==0, L=2*rm*1.1; end
  H=(ymax-ymin)*1.1; if H==0, H=2*rm*1.1; end
  x0=(xmin+xmax)/2; y0=(ymin+ymax)/2;
  rect=[x0-L/2 y0-H/2 x0+L/2 y0+H/2]

  // Special case: data aligned on the x or y axis
  if Q==[%F %F %F %F],
if (ymax-ymin)<2*e, // on x axis
  if xmin<-e then
Q([2 3])=%T
  end
  if xmax> e  then
Q([1 4])=%T
  end
else  // on y axis
  if ymin<-e  then
Q([3 4])=%T
  end
  if ymax> e then
Q([1 2])=%T
  end
end
  end

  n=find(Q);   // id numbers of quadrants to be drawn
  

Re: [Scilab-users] more polarplots in one coordinate system

2016-11-28 Thread Samuel Gougeon

Le 28/11/2016 16:01, Maxi041291 a écrit :

Thank you for trying to help, but i think i didnt describe my Problem well
enough.
Normally there should be arrows in the plot,

You did not require this previously.

but i dont think this is
possible in scilab.

https://help.scilab.org/docs/6.0.0/en_US/polyline_properties.html


But here a Piece of my original code in scilab:

clear;
clc;
phase=[0;-2.8487;-2.993; 2.9664;2.8264;2.9638];
magnitude=[0;1.25e-4;2.17e-4;1.34e-4;7.5e-5;1.32e-4];
allmagnitude=[0; 1.32e-4];
allphase=[0;2.9638];
//This is how it works, but just for a defined length of the vectors
clf(1);
polarplot([phase(1:2) phase(2:3) phase(3:4) phase(4:5) phase(5:6)
allphase],[magnitude(1:2) magnitude(2:3) magnitude(3:4) magnitude(4:5)
magnitude(5:6) allmagnitude],[5,2,3,1,4,9]);


Sorry, i don't understand what you wish: Do you really wish to have each 
segment one by one with a different color?




//This is the way it doesnt work
clf(2);
polarplot(phase,magnitude,[5,2]);
polarplot(allphase,allmagnitude,[1,2]);


Anyway, you must call polarplot() only once. Or to convert 
(angles,radii) => (x, y) yourself before using plot() instead of polarplot()







Because the length of the vectors (Magnitude and Phase) is not fixed in my
original code,

What do you mean by "is not fixed"?

i think i cant define the polarplot like its done in the
first example.
So i would like to do it like in the second example, but that doesn´t work,
because i get a new axis for each datapoint


With polarplot, presently you can't avoid it. Each call yields a polar 
frame.


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


Re: [Scilab-users] more polarplots in one coordinate system

2016-11-28 Thread Maxi041291
Thank you for trying to help, but i think i didnt describe my Problem well
enough.
Normally there should be arrows in the plot, but i dont think this is
possible in scilab.

But here a Piece of my original code in scilab:


clear;
clc;
phase=[0;-2.8487;-2.993; 2.9664;2.8264;2.9638];
magnitude=[0;1.25e-4;2.17e-4;1.34e-4;7.5e-5;1.32e-4];
allmagnitude=[0; 1.32e-4];
allphase=[0;2.9638];
//This is how it works, but just for a defined length of the vectors
clf(1);
polarplot([phase(1:2) phase(2:3) phase(3:4) phase(4:5) phase(5:6)
allphase],[magnitude(1:2) magnitude(2:3) magnitude(3:4) magnitude(4:5)
magnitude(5:6) allmagnitude],[5,2,3,1,4,9]);

//This is the way it doesnt work
clf(2);
polarplot(phase,magnitude,[5,2]);
polarplot(allphase,allmagnitude,[1,2]);




Because the length of the vectors (Magnitude and Phase) is not fixed in my
original code, i think i cant define the polarplot like its done in the
first example.
So i would like to do it like in the second example, but that doesn´t work,
because i get a new axis for each datapoint
 




--
View this message in context: 
http://mailinglists.scilab.org/more-polarplots-in-one-coordinate-system-tp4035127p4035130.html
Sent from the Scilab users - Mailing Lists Archives mailing list archive at 
Nabble.com.
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] more polarplots in one coordinate system

2016-11-28 Thread Samuel Gougeon

Hello

Le 28/11/2016 11:12, Maxi041291 a écrit :

Hello together,

i would like two plot a few polarplots in one coordinate-system. The number
of the plots should be defined by the length of a vector.
In Matlab i would use the hold on command in a for Loop for it.

I know, that i dont Need the hold on command in the plot(), but if i define
two polarplots, i get two different coordinate Systems.
For e.g.
polarplot(Phase,magnitude)
polarplot(Phase1, magnitude1)

I have to define those in one polarplot to get one coordinate System for
both:
polarplot([Phase phase1],[Magnitude,magnitude1]).

Now my question is:

how can i automatically define more polarplots (depending on the length of
my vectors) in one coordinate System?


If i understand well: you have several curves having different numbers 
of points, and you want to plot all of them on the same polarplot?

The only way i see presently to do that is
* to get the size of the longest vector
* to padd all other ones with %nan values
* finally to send the matrix of all concatenated vectors -- one column 
per curve


Example:

longest  =  100;   // maximal number of points
nc  =  2;  // number of curves
theta  =  zeros(longest,  nc)  +  %nan;
r  =  theta;

// Curve #1
i  =  1;
tmp  =  0:75;
theta(1:length(tmp),i)  =  tmp;
r(1:length(tmp),i)  =  sind(2*tmp);

// Curve #2
i  =  2;
tmp  =  45:135;
theta(1:length(tmp),i)  =  tmp;
r(1:length(tmp),i)  =  cosd(5*tmp);

// Display
polarplot(theta/180*%pi,  r)



HTH
Samuel Gougeon

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


Re: [Scilab-users] xtitle seems to suppress plot

2016-11-28 Thread Jens Simon Strom

My workaround is to allow Scilab a little nap:

xdel();
cf=figure("immediate_drawing",'off', 'visible','off','background',8);
plot(1:2)
cf.immediate_drawing="on";  cf.visible="on";
sleep(100)//
xtitle('xtitle() suppresses plot content when not delayed by sleep(). Ver. 
5.5.2, my Win 10, 64 bit')

Does this make sense under a deeper understanding of Scilab, regarding 
also that the very first  execution (after start of Scilab) is proper 
without 'sleep'?


Cheers
Jens
--
Am 28.11.2016 01:56, schrieb Rafael Guerra:

Works alright every time on Scilab 5.5.2 64-bit Win7 but plot background is grey


-Original Message-
From: users [mailto:users-boun...@lists.scilab.org] On Behalf Of Tim Wescott
Sent: Monday, November 28, 2016 12:19 AM
To: Jens Simon Strom 
Cc: Users mailing list for Scilab 
Subject: Re: [Scilab-users] xtitle seems to suppress plot

Over and over, it works every time.

Maybe file a bug report?

On Sun, 2016-11-27 at 23:11 +0100, Jens Simon Strom wrote:

Hallo Tim,
It may be of interest that the script works when it is  executed
directly after start of Scilab. All further runs fail - reproducibly.
Tim, would you be so kind to run the script twice on your
installation.
  Cheers
Jens

Am 27.11.2016 19:41, schrieb Jens Simon Strom:


I use scilab-5.5.2.
I just tried 5.4.0. There the script works.
Cheers
Jens
--



Am 27.11.2016 19:00, schrieb Tim Wescott:


On Sun, 2016-11-27 at 18:06 +0100, Jens Simon Strom wrote:

Hallo,
Instead of drawlater/drawnow I prefer the below approach for starting
a figure because no  windows flicker temporarily on the screen. This
works fine exept when 'xtitle' is used.  Inspecting the figure's,
axes', compound's  and polyline's data I get no hint that the axes
should be invisible. How can I make the axes appear without initial
flicker?
xdel();
cf=figure("immediate_drawing",'off', 'visible','off');
plot(rand(1,5))
sleep(1000)//only for checking invisibility of new figure
cf.immediate_drawing="on";  cf.visible="on";
//xtitle('xtitle seems to suppress plot content.')
Cheers
Jens

Works fine for me; Scilab 5.5.0 on Ubuntu 14.04.  Background is weird,
though.

-->getversion
  ans  =
  
  scilab-5.5.0
  



___
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