ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sun, 07 Apr 2019 18:44:01 +0200Color plots on surface of spherehttps://ask.sagemath.org/question/9753/color-plots-on-surface-of-sphere/I would like to use Sage to draw colormap plots of spherical functions on the surface of spheres. I want to produce something like
[this example](http://mailinglists.scilab.org/Plotting-functions-of-spherical-coordinates-on-a-sphere-td4025441.html).
Are such plots currently possible in Sage, or using optional toolkits? I would like to have a color plots of arbitrary functions f(theta,phi).
Moreover, is it possible to have contour plots of such functions as well?
Wed, 30 Jan 2013 12:05:04 +0100https://ask.sagemath.org/question/9753/color-plots-on-surface-of-sphere/Comment by ppurka for <p>I would like to use Sage to draw colormap plots of spherical functions on the surface of spheres. I want to produce something like
<a href="http://mailinglists.scilab.org/Plotting-functions-of-spherical-coordinates-on-a-sphere-td4025441.html">this example</a>.</p>
<p>Are such plots currently possible in Sage, or using optional toolkits? I would like to have a color plots of arbitrary functions f(theta,phi).</p>
<p>Moreover, is it possible to have contour plots of such functions as well?</p>
https://ask.sagemath.org/question/9753/color-plots-on-surface-of-sphere/?comment=18321#post-id-18321If it is possible using scipy and matplotlib, then you can use those directly in sage. I don't think it is possible by using some Sage function directly.Thu, 31 Jan 2013 04:04:28 +0100https://ask.sagemath.org/question/9753/color-plots-on-surface-of-sphere/?comment=18321#post-id-18321Answer by FrédéricC for <p>I would like to use Sage to draw colormap plots of spherical functions on the surface of spheres. I want to produce something like
<a href="http://mailinglists.scilab.org/Plotting-functions-of-spherical-coordinates-on-a-sphere-td4025441.html">this example</a>.</p>
<p>Are such plots currently possible in Sage, or using optional toolkits? I would like to have a color plots of arbitrary functions f(theta,phi).</p>
<p>Moreover, is it possible to have contour plots of such functions as well?</p>
https://ask.sagemath.org/question/9753/color-plots-on-surface-of-sphere/?answer=46039#post-id-46039Something like this:
var('x,y')
cm = colormaps.spring
cf = lambda x,y: (sin(x) + cos(y)) % 1
spherical_plot3d(1,(x,0,4*pi/2),(y,0,pi),color=(cf,cm)).show(aspect_ratio=(1,1,1))
The look is not as smooth as one would like with the default number of plot points.
For a smoother look, increase the number of plot points.
sage: cm = colormaps.spring
sage: f = lambda x, y: 1
sage: cf = lambda x, y: (sin(x) + cos(y)) % 1
sage: p = spherical_plot3d(f, (0, 2*RDF.pi()), (0, RDF.pi()), color=(cf, cm), plot_points=200)
sage: p.show(aspect_ratio=1, viewer='threejs')
Higher values of `plot_points` increase resolution (but also time to display the plot).
Try for example `plot_points=400` or even `plot_points=800`...Sun, 07 Apr 2019 18:44:01 +0200https://ask.sagemath.org/question/9753/color-plots-on-surface-of-sphere/?answer=46039#post-id-46039Answer by Jason Grout for <p>I would like to use Sage to draw colormap plots of spherical functions on the surface of spheres. I want to produce something like
<a href="http://mailinglists.scilab.org/Plotting-functions-of-spherical-coordinates-on-a-sphere-td4025441.html">this example</a>.</p>
<p>Are such plots currently possible in Sage, or using optional toolkits? I would like to have a color plots of arbitrary functions f(theta,phi).</p>
<p>Moreover, is it possible to have contour plots of such functions as well?</p>
https://ask.sagemath.org/question/9753/color-plots-on-surface-of-sphere/?answer=14500#post-id-14500I don't think the Sage 3d graphics allow very much flexibility for coloring currently. Here is an example showing how to color a 3d surface using matplotlib, though: [http://stackoverflow.com/a/6543777/1200039](http://stackoverflow.com/a/6543777/1200039)
Fri, 01 Feb 2013 00:15:15 +0100https://ask.sagemath.org/question/9753/color-plots-on-surface-of-sphere/?answer=14500#post-id-14500