[Scilab-users] Plotting functions of spherical coordinates on a sphere

Samuel Gougeon sgougeon at free.fr
Sat Dec 8 17:22:12 CET 2012


Le 08/12/2012 16:11, Rafael Guerra a écrit :
> Samuel,
>
> Thanks for the very useful link provided, despite that I could not find what
> I was looking for.
> For example, how to plot a function such as a surface temperature field
> T=T(polar angles) on a sphere using the color scale to differentiate the
> temperature values?
Here is an example:

a  =  linspace(0,360,100);
th  =  linspace(-90,90,50);
R  =  1;
[A,Th]  =  meshgrid(a,th);
Z  =  R*sind(Th);
X  =  R*cosd(Th).*cosd(A);
Y  =  R*cosd(Th).*sind(A);
Ncolors  =  100;                   // Number of coding colors
temp  =  pmodulo(A+Th,Ncolors)+1;  // Here gives the spherical mapping of your data
clf
f  =  gcf();
f.color_map  =  jetcolormap(Ncolors);
surf(X,Y,Z,temp)
ax  =  gca();
ax.isoview  =  'on';
e  =  gce();
e.thickness  =  0;
e.thickness  =  0;  // hides the mesh
e.color_flag  =  3;  // switches to interpolated colors

and the result (without and with interpolated colors):



HTH
Samuel


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20121208/e6cf58dc/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cajccbci.png
Type: image/png
Size: 16220 bytes
Desc: not available
URL: <https://lists.scilab.org/pipermail/users/attachments/20121208/e6cf58dc/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bhdghcdb.png
Type: image/png
Size: 23619 bytes
Desc: not available
URL: <https://lists.scilab.org/pipermail/users/attachments/20121208/e6cf58dc/attachment-0001.png>


More information about the users mailing list