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.Wed, 10 Feb 2021 19:07:25 +0100plot3d shows a black windowhttps://ask.sagemath.org/question/55661/plot3d-shows-a-black-window/ I am using Manjaro 20.1 linux with firefox 85 and Chromium 88. I update to sage math 9.2 and now the plot3d only shows a black screen. It works with jmol and tachyon, but not with threejs nor canvas3d.
Any help is appreciated.
Thanks in advance13negroWed, 10 Feb 2021 19:07:25 +0100https://ask.sagemath.org/question/55661/Calimero effect in plot3dhttps://ask.sagemath.org/question/54100/calimero-effect-in-plot3d/ just out of curiosity, what is the reason for this [Calimero effect](https://sagecell.sagemath.org/?q=ujyywl) ? ![image description](https://nospensees.fr/wp-content/uploads/2020/06/calimero.png)?
from sage.plot.plot3d.plot3d import axes
var('x,y,z,r,alpha,beta,gamma',domain='real')
#rNum=1;alphaNum=0;betaNum=pi/4;gammaNum=pi/4
#rNum=1;alphaNum=pi/7;betaNum=pi/7;gammaNum=pi/7
rNum=1.0;alphaNum=pi/12;betaNum=pi/8;gammaNum=pi/6
numL=[r==rNum,alpha==alphaNum,beta==betaNum,gamma==gammaNum]
eqS=r^2==x^2+y^2+z^2
X=solve(eqS,x)[1].rhs()
Y=solve(eqS,y)[1].rhs()
Z=solve(eqS,z)[1].rhs()
Znum=Z.subs(numL)
S = matrix(SR,[X,Y,Z]).transpose()
Snum=S.subs(numL)
#show('S : ',S,'\t S num : ',Snum)
Plt=plot3d(Znum, (x,0,rNum), (y,0,rNum) , frame=False, color="blue",opacity=0.1)
# plot the three axis
Plt+=arrow((0,0,0), (rNum,0,0), color='black')
Plt+=text3d("X",vector([rNum,0,0])*1.1, color='black')
Plt+=arrow((0,0,0), (0,rNum,0), color='brown')
Plt+=text3d("Y",vector([0,rNum,0])*1.1, color='brown')
Plt+=arrow((0,0,0), (0,0,rNum), color='red')
Plt+=text3d("Z",vector([0,0,rNum])*1.1, color='red')
margin=0.1
show(Plt,xmax=rNum+margin,ymax=rNum+margin,zmax=rNum+margin)
ortolljMon, 02 Nov 2020 08:32:27 +0100https://ask.sagemath.org/question/54100/Use of threejs and jmol in sage 9.1 for windowshttps://ask.sagemath.org/question/53861/use-of-threejs-and-jmol-in-sage-91-for-windows/ I have been using SageMath 9.1 in Ubuntu 18.04 and the performance is excellent -- no questions asked.
Now I am trying to use SageMath 9.1 in a Msc level course, but the students' computers are all under Windows 10, and so on the classroom computer I have installed the latest 64 version of SageMath 9.1(with the 3 icons in the desktop, including the Jupyter NB which is the environment I always use). Using it, 3D scenes can only be seen as still images using "viewer='tachyon'". When using "viewer='jmol'" or "viewer='threejs'",there is no error message a scene is created, but it is empty -- blank space, no image. It seems that threejs and jmol are bundled in the repo for the Windows version of SageMath but for some reasons do not work.
In Windows 10 I have anaconda3 installed with Python 3 environment and Jupyter NB. Using it, I have tried to install Sagemath 9.1 from conda-forge using 'conda' (insluding conda-forge as a channel, with and without 'mamba' -- according to the respective instructions in the Sage manual for installing sage from anaconda) and this worked well in Ubuntu but not in Windows 10 -- in the latter case I get error message on the anaconda prompt:
Encountered problems while solving.
Problem: nothing provides requested sage
I have now also installed node.js and npm and, via the latter, also three.js . However, the installed SageMath does not recognize this version, and I do not know how to import it in the installed SageMath 9.1.
As a last measure, I have also installed the latest 64 version of Java and the latest 64 version of jmol (to be used via double-click on jmol.jar in the decompressed jmol bundle). The problem is similar as with threejs: the SageMath 9.1 does not recognize the installed jmol, and I do not know how to make it do so.
This is the situation. Can you help resolve this? I need to be able to use at least one of threejs and/or jmol (preferably, threejs!!) as alternative to tachyon in visualizing 3D scenes. Otherwise, I will have to radically restructure the course without using SageMath, since using Linux instead of Windows is, unfortunately, not an option. ShaolinuxMon, 12 Oct 2020 13:35:15 +0200https://ask.sagemath.org/question/53861/plot3d displaying black graph in jupyter for both 9.0 and 9.1https://ask.sagemath.org/question/52722/plot3d-displaying-black-graph-in-jupyter-for-both-90-and-91/I installed sage 9.1, and also installed its kernel on Jupyter.
Everything other than `plot3d` works fine.
For `plot3d`, the behavior of 9.1 is same as 9.0, it shows a black background.
If drag the mouse on it, it shows an empty frame on white background.
For example:
sage: f = lambda x, y: exp(-x**2-y**2)
sage: W = plot3d(f, (-2, 2), (-2, 2))
sage: show(W, figsize=8)
I tried all the options, with or without switch viewer="threejs".luqiyi@gmail.comTue, 28 Jul 2020 16:38:12 +0200https://ask.sagemath.org/question/52722/Animate 3d surface and add some curves ?https://ask.sagemath.org/question/46284/animate-3d-surface-and-add-some-curves/ I want animate my surface of hyperboloid by adding 2 point then draw a geodesic curve between them .
Thanks for ur help guys Taoufik ahanchaouSat, 20 Apr 2019 08:15:49 +0200https://ask.sagemath.org/question/46284/Vertex list of a surface not readily accessiblehttps://ask.sagemath.org/question/51608/vertex-list-of-a-surface-not-readily-accessible/ While preparing my answer to [this question](https://ask.sagemath.org/question/51567/how-to-plot-projections-of-a-3d-surface-onto-coordinate-planes/), I have been searching how to retrieve faces and vertices from a explicit surface plotted with `plot3d`. There is a fact that confuses me. Consider this code:
sage: surf = plot3d(lambda x,y: sin(x*y), (-pi,pi), (-pi,pi))
sage: len(surf.vertex_list())
0
This means that `surf.vertex_list()` is an empty list. However:
sage: surf = plot3d(lambda x,y: sin(x*y), (-pi,pi), (-pi,pi))
sage: show(surf)
Launched html viewer for Graphics3d Object
sage: len(surf.vertex_list())
1600
Now `surf.vertex_list()` is not an empty list and the vertices can be retrieved. So I wonder what `show(surf)` internally does so that the vertices list becomes accessible. To avoid plotting the surface, I have found that I can replace `show(surf)` by `surf.triangulate()`, but I also wonder if there is a best option.JuanjoThu, 28 May 2020 15:58:33 +0200https://ask.sagemath.org/question/51608/Plotting surfaces over non-rectangular domainhttps://ask.sagemath.org/question/51485/plotting-surfaces-over-non-rectangular-domain/I'm wondering if we can plot a surface over non-rectangular domain.
E.g.
plot3d(lambda x, y: 2 + sin(x) + cos(y) if y < 2*pi - x else False, (x,x0,x1), (y,y0,y1))
or something. I've tried playing with the domain like
implicit_plot3d( (s,t,2+sin(s)+cos(t)), (s,0,2*pi), (t,0 2*pi - s) )
but again no dice. I'm sure I could just draw a whole bunch of polygons but I wonder if there's a better way.ShaiThu, 21 May 2020 23:56:26 +0200https://ask.sagemath.org/question/51485/Plot3D deboxedhttps://ask.sagemath.org/question/51368/plot3d-deboxed/ This code works nicely
var("x,y,z")
f(x,y) = (.5*x^0.4+.5*y^0.4)
z1, z2 = 0, 1.3
ni = 5
dz = (z2-z1)/ni
levels = [z1,z1+dz..z2]
curves = contour_plot(f(x,y),(x,.001,2), (y,.001,2), contours=levels,
cmap="gist_earth")
def col2(x,y):
return float(0.5*dz+floor((f(x,y)-z1)/dz)/ni)
surf = plot3d(f(x,y), (x,.001,2), (y,.001,2), color=(col2,colormaps.gist_earth), plot_points=300)
arrow1= arrow3d((0,0,0), (2,0,0), 1)
arrow2= arrow3d((0,0,0), (0,2,0), 1)
arrow3= arrow3d((0,0,0), (0,0,2), 1)
t1=text3d("x", (2.15,0,0), color=(0.5,0,0))
t2= text3d("y", (0,2.15,0), color=(0.5,0,0))
t3= text3d("EU", (0,0,3.), color=(0.5,0,0))
offset = 0
plane = plot3d(offset, (x,.001,2), (y,.001,2), color=(col2,colormaps.gist_earth), plot_points=300,viewer='threejs')
show(surf+plane+arrow1+arrow2+arrow3+t1+t2+t3)
I know that I could not have presently LaTeX label but I wonder if there is a way to debox it.
CyrilleSun, 10 May 2020 20:53:16 +0200https://ask.sagemath.org/question/51368/plot3d method does not properly work with threejshttps://ask.sagemath.org/question/50051/plot3d-method-does-not-properly-work-with-threejs/ The `plot3d` method allows to embed 2D objects in 3D graphics. It seems to work properly with the jmol viewer. However, it fails when the viewer is threejs. For example, the code
p = sum(plot((5-k)*sin(x), 0, 10, thickness=10,
color=colormaps.jet(50*k)).plot3d(z=k) for k in range(6))
show(p, viewer="jmol")
show(p, viewer="threejs")
yields this result:
![image description](/upfiles/1582626986673771.png)
The first graphic, corresponding to jmol, is correct. The second graphic, produced by threejs, is completely wrong.JuanjoTue, 25 Feb 2020 11:37:40 +0100https://ask.sagemath.org/question/50051/How do i plot a piecewise function with functional constraints?https://ask.sagemath.org/question/49060/how-do-i-plot-a-piecewise-function-with-functional-constraints/ I have to plot a function T(x,x) which equals x*y if x*y>0 and x+y otherwise. I have defined the function:
def T(x,y):
if (x*y>0):
return x*y
else:
return x+y
but it does not work.mattiavTue, 17 Dec 2019 15:34:09 +0100https://ask.sagemath.org/question/49060/Saving notebooks with 3dplotshttps://ask.sagemath.org/question/48061/saving-notebooks-with-3dplots/ Hi I tried both html and .pdf, but the 3dplots seem to have disappeared. Is there a trick to get a copy of your session,
includimg the 3dplots?florinWed, 25 Sep 2019 19:28:27 +0200https://ask.sagemath.org/question/48061/Discontinuous surface color by z-levelhttps://ask.sagemath.org/question/46541/discontinuous-surface-color-by-z-level/Hi there,
I want to plot a surface $z=f(x,y)$ together with the level curves (side by side). I know how to doi it when $f$ is continuous, or even bounded, but I run in trouble for uglier functions. Here are two examples (in CoCalC : a few things need to be adapted to use Jupyter) : the first works
var('x,y,s,t')
h(x,y)= x*y^2/(x^2+y^4)
cm = colormaps.Blues
def c(x,y):
return 0.6+x*y^2/(x^2+y^4+0.005)# Colorier ceci pose des problèmes, à cause de la singularité.
S=plot3d(h,(x,-1,1),(y,-1,1),color = (c,cm), opacity=1, mesh=1)
show(S)
C=contour_plot(h, (x,-1, 1), (y,-1, 1),cmap='Blues',linestyles='solid', colorbar=True)
show(C,figsize=4)
While the second, below, does not work as I would like to
h(x,y)= y/(x^2+y^2)
cm = colormaps.Spectral
def c(x,y):
return float(y/(x^2 + y^2+0.005))# Colorier ceci pose des problèmes, à cause de la singularité.
S=plot3d(h,(x,-1,1),(y,-1,1),color = (c,cm), opacity=1, mesh=1)
show(S, frame_aspect_ratio=[20,20,1])
C=contour_plot(h,(x,-1.5,1.5),(y,-1.5,1.5), cmap = "Spectral",
contours = [-2,-1, -0.5,-0.25,0,0.25,0.5,1,2], colorbar = True,
axes = True,
labels = True, label_colors='black',
label_inline=True, label_fontsize=8,
gridlines = True, axes_labels=['$x$','$y$'])
show(C,figsize=8)
I tried a few things, among other, what can be found https://ask.sagemath.org/question/7581/use-a-colormap-for-implicit_plot3d/[here (old post)](https://ask.sagemath.org/question/7581/use-a-colormap-for-implicit_plot3d/), but the discontinuity seems to cause some problems.
Suggestions?JCThu, 16 May 2019 03:12:51 +0200https://ask.sagemath.org/question/46541/How to combine 3d and 2d plots?https://ask.sagemath.org/question/46508/how-to-combine-3d-and-2d-plots/ Hi, I am trying to include 2d plots of a 3d functions in specific points, fx. if i have a plottet function z=y*z and then i want to plot a function over when y=1 or 2 or 3 and so on. or when x=1 or 2 or 3 and so on.
I am dealing with this assignment:
sage: x,y,z = var('x,y,z')
sage: f = x^2+sqrt(y)
Then i can prepare that one for a 3d plot
sage: P = f.plot3d((x,-5,5),(y,-5,5),color="red",opacity=0.7)
Then i read something somewhere that you can put the cuts in the 3dplot by
sage: plot3d(z=0, **kwds)
and they gave the EXAMPLE:
sage: sum([plot(z*sin(x), 0, 10).plot3d(z) for z in range(6)]) #long
So for my case i try
sage: S = sum([plot(x^2+sqrt(y), -5,5 for y in range(6)])
sage: K = P+S
sage: K.show(aspect_ratio=[1,1,1])
Because i don't know how to include the z axis in the example. So i get some lines but they are lying down on the x/y axis i tried changing the variable y with z but it doesnt change anything.
Please help me!
Kind regards
Martin MårtenssonMartin MårtenssonMon, 13 May 2019 21:52:54 +0200https://ask.sagemath.org/question/46508/Point -> Vector to a pointhttps://ask.sagemath.org/question/46034/point-vector-to-a-point/Hello everyone,
If i have point in 3D
A=point3d((4,3,2),size=10,color='red',opacity=.5)
How to create a vector from the origin to the point.
I know i could define the vector. But I would rather have a point, for plotting reasons
And i would like to plot the Point and the Vector, with automatic labeling of the coordinates.
I have managed to do this like:
from sage.plot.plot3d.shapes2 import frame3d
F=frame3d([0,0,0],vector([10,10,10]),color='red')
A=points((4,3,2),size=10,color='red',opacity=.5)
B=point([(4,3,8)],size=10,color='red',opacity=.5)
t = var('t')
p = vector([4,3,2])
q = vector([0,0,0])
vec=parametric_plot3d(p*t+q, (t,0,1))
#vectB=vector(B.xdata[1],B.ydata[1],B.zdata[1])
e=0.2
eps=vector([4+e,3+e,2+e])
T_A = text3d('A',eps)
#T_B = text3d('B',B)
F+A+T_A+B+vec
Is there any better, way to do it?
Here is the file:
https://share.cocalc.com/share/a3f14e05-7729-406f-97c5-be5b73646381/vector/ebene.sagews?viewer=sharethethaSun, 07 Apr 2019 00:10:33 +0200https://ask.sagemath.org/question/46034/plot3d not displaying - only says "Graphics3d Object"?!https://ask.sagemath.org/question/41731/plot3d-not-displaying-only-says-graphics3d-object/ Hello
I have a problem, I hope you can help. I'm trying to use plot3d, but instead of drawing a plot, it just prints out the text "Graphics3d Object"
Here is an example Sage snippet that exhibits this problem:
f(x,y) = abs(x*y)
X = plot3d(f, (x,105,72), (y,0.8293,55.8271));
show(X)
I have seen some functions plot OK -- I can't see a pattern to when it does and doesn't work. For example, this does work:
f(x,y) = abs(x*y)
X = plot3d(f, (x,0,10), (y,0,10));
show(X)
This bug is repeatable. I am using 64 bit Linux Mint (Ubuntu), and using the notebook in latest Firefox.
Any help much appreciated.
Thank you,
- Daniel
wintersteinFri, 23 Mar 2018 11:08:02 +0100https://ask.sagemath.org/question/41731/3d plots flattened when printing to filehttps://ask.sagemath.org/question/41312/3d-plots-flattened-when-printing-to-file/When I print to file using The Sage Notebook (flask) - clicking the print option and then printing to file using CUPS - everything is displayed correctly except plot3d plots which are squeezed to have a height of a few centimeters while the width remains the same. I do not have the same problem with other types of plots like "plot" or "countourplot".
I do not know whether this has anything to do with my screen being 4k, but it reminds me of similar picture scaling issues I have with maple.
What I get: https://s17.postimg.org/d3q80qlf3/screenshot.png
What I expected: https://s17.postimg.org/72sj3vokv/screenshot.pngPoetastropheWed, 28 Feb 2018 18:48:39 +0100https://ask.sagemath.org/question/41312/"mesh=" juypter vs. -notebookhttps://ask.sagemath.org/question/35802/mesh-juypter-vs-notebook/Perhaps I should send this to some devel or support group ?
Starting command line:
sage -notebook
Comes up and executes:
var('x,y')
plot3d(sin(x-y)*y*cos(x),(x,-3,3),(y,-3,3), mesh=True)
Correctly.
Whereas:
sage -n jupyter
Fails with miscellaneous assertion type errors.
sagemath 7.3 in both cases.
A friend also point out the option "color='yellow' " also fails in jupyter.
----------
Edit (slelievre):
I confirm I can observe this also with Sage 7.4. Here is the error message I get:
---------------------------------------------------------------------------
AssertionError Traceback (most recent call last)
<ipython-input-3-44b2387a145a> in <module>()
----> 1 plot3d(sin(x-y)*y*cos(x),(x,-Integer(3),Integer(3)),(y,-Integer(3),Integer(3)), mesh=True)
/opt/s/sage-7.4/local/lib/python2.7/site-packages/IPython/core/displayhook.pyc in __call__(self, result)
244 self.start_displayhook()
245 self.write_output_prompt()
--> 246 format_dict, md_dict = self.compute_format_data(result)
247 self.update_user_ns(result)
248 self.fill_exec_result(result)
/opt/s/sage-7.4/local/lib/python2.7/site-packages/IPython/core/displayhook.pyc in compute_format_data(self, result)
148
149 """
--> 150 return self.shell.display_formatter.format(result)
151
152 # This can be set to True by the write_output_prompt method in a subclass
/opt/s/sage-7.4/local/lib/python2.7/site-packages/sage/repl/display/formatter.pyc in format(self, obj, include, exclude)
158 # First, use Sage rich output if there is any
159 PLAIN_TEXT = u'text/plain'
--> 160 sage_format, sage_metadata = self.dm.displayhook(obj)
161 assert PLAIN_TEXT in sage_format, 'plain text is always present'
162 if sage_format.keys() != [PLAIN_TEXT]:
/opt/s/sage-7.4/local/lib/python2.7/site-packages/sage/repl/rich_output/display_manager.pyc in displayhook(self, obj)
764 self._backend.set_underscore_variable(obj)
765 plain_text, rich_output = self._rich_output_formatter(obj, dict())
--> 766 return self._backend.displayhook(plain_text, rich_output)
767
768 def display_immediately(self, obj, **rich_repr_kwds):
/opt/s/sage-7.4/local/lib/python2.7/site-packages/sage/repl/rich_output/backend_ipython.pyc in displayhook(self, plain_text, rich_output)
525 from sage.repl.display.jsmol_iframe import JSMolHtml
526 jsmol = JSMolHtml(rich_output, height=500)
--> 527 return ({u'text/html': jsmol.iframe(),
528 u'text/plain': plain_text.text.get_unicode(),
529 }, {})
/opt/s/sage-7.4/local/lib/python2.7/site-packages/sage/repl/display/jsmol_iframe.py in iframe(self)
259 </iframe>
260 """
--> 261 escaped_inner_html = self.inner_html().replace('"', '"')
262 iframe = IFRAME_TEMPLATE.format(
263 script=self.js_script(),
/opt/s/sage-7.4/local/lib/python2.7/site-packages/sage/repl/display/jsmol_iframe.py in inner_html(self)
235 """
236 return INNER_HTML_TEMPLATE.format(
--> 237 script=self.js_script(),
238 width=self._width,
239 height=self._height,
/opt/s/sage-7.4/local/lib/python2.7/site-packages/sage/repl/display/jsmol_iframe.py in js_script(self)
193 """
194 script = [r"["]
--> 195 for line in self.script().splitlines():
196 script += [r" '{0}',".format(line)]
197 script += [r"].join('\n');"]
/opt/s/sage-7.4/src/sage/misc/cachefunc.pyx in sage.misc.cachefunc.CachedMethodCallerNoArgs.__call__ (/opt/s/sage-7.4/src/build/cythonized/sage/misc/cachefunc.c:12716)()
2399 if self.cache is None:
2400 f = self.f
-> 2401 self.cache = f(self._instance)
2402 return self.cache
2403
/opt/s/sage-7.4/local/lib/python2.7/site-packages/sage/repl/display/jsmol_iframe.py in script(self)
156 command, obj, meshfile = line.split(' ', 3)
157 assert command == 'pmesh'
--> 158 assert meshfile.startswith('"') and meshfile.endswith('"\n')
159 meshfile = meshfile[1:-2] # strip quotes
160 script += [
AssertionError:rrogersWed, 30 Nov 2016 00:42:58 +0100https://ask.sagemath.org/question/35802/Numerical Integral with variable paramshttps://ask.sagemath.org/question/40618/numerical-integral-with-variable-params/ I am trying to write some code to plot a function of an integral whose integrand depends on two variables, much like the following:
a = var('a')
b = var('b')
plot3d(numerical_integral((x+a+b), 0, 1, params=[a,b])[0],(a,0,1),(b,0,1))
This code raises an error `NotImplementedError: free variable: b`. Which would be the correct way to implement this code?jepstraMon, 15 Jan 2018 16:24:26 +0100https://ask.sagemath.org/question/40618/ParametrizedSurface3D to epshttps://ask.sagemath.org/question/40420/parametrizedsurface3d-to-eps/Can I convert a ParametrizedSurface3D plot to an eps file? I understand it's not a Graphics object, does this mean there's no hope?jdtj2Mon, 01 Jan 2018 15:55:35 +0100https://ask.sagemath.org/question/40420/Remove shadows from axes in plot3d with viewer tachyonhttps://ask.sagemath.org/question/39972/remove-shadows-from-axes-in-plot3d-with-viewer-tachyon/I would like to remove the shadows from the axes that are projected onto a plot3d image I created. Thank you in advance.NonlocalWed, 06 Dec 2017 17:08:42 +0100https://ask.sagemath.org/question/39972/Sagemath 8.0 and Sagemath 8.1 and Windows 10https://ask.sagemath.org/question/39798/sagemath-80-and-sagemath-81-and-windows-10/ It seems that there is no solution to my problem but I am still hoping. I installed the Windows native version of Sagemath and every try to use plot3d (i.e. var('y') plot3d( 4*x*exp(-x^2-y^2), (x,-2,2), (y,-2,2))) runs into the following error:
/opt/sagemath-8.0/local/lib/python2.7/site-packages/sage/repl/rich_output/display_manager.py:590: RichReprWarning: Exception in _rich_repr_ while displaying object: Jmol failed to create file '/dot_sage/temp/Sandman/16196/dir_oUJsU7/preview.png', see '/dot_sage/temp/Sandman/16196/tmp_9jJjSY.txt' for details
RichReprWarning,
Is anybody out there who can help to fix that Sagemath bug?
Thanks for your help!AiKjuSun, 26 Nov 2017 15:38:09 +0100https://ask.sagemath.org/question/39798/How to color a 3d plot by z-level?https://ask.sagemath.org/question/8964/how-to-color-a-3d-plot-by-z-level/I'd like to color a 3d plot based on z-level. I think this is easy to do in Maple or Mathematica, but I've been searching the web for help on doing this in Sage and can't find anything to help with plot3d or implicit_plot3d.
Here's the implicit_plot3d I'm using.
var('x,y,z')
implicit_plot3d(x^2-y^2*z == 0,(x,-4,4),(y,-4,4),(z,-4,4)).show(mesh=True)
Also, are there color maps in Sage that produce plots with colors and lighting similar to the default in Mathematica?
calc314Wed, 09 May 2012 23:27:40 +0200https://ask.sagemath.org/question/8964/use a colormap for implicit_plot3dhttps://ask.sagemath.org/question/7581/use-a-colormap-for-implicit_plot3d/Here's a question I asked a while ago on sage-support, but never got answered, so I'll try it again here:
I've been trying to figure out how to plot a surface using
`implicit_plot3d`, and color it according to a particular color map. I
see that `implicit_plot3d` passes its arguments to
`sage.plot.plot3d.implicit_plot3d.ImplicitSurface`
but I can't figure out more than this . . . when I try
`sage: sage.plot.plot3d.implicit_plot3d.ImplicitSurface??`
I get
`Error getting source: could not find class definition`
and then a few more unhelpful details.
It seems like the two possible viewers are jMol and Tachyon, but I
can't tell whether either of these support color maps.
Any ideas where else I should be looking?
Update: This is now Trac ticket 12212nilesThu, 19 Aug 2010 07:26:08 +0200https://ask.sagemath.org/question/7581/Color parametric_plot3d by a rgb color rather than a colormap.https://ask.sagemath.org/question/36386/color-parametric_plot3d-by-a-rgb-color-rather-than-a-colormap/ I know I can color a 3d plot using a function and a color map. What I would like to do is to color a plot using a function that return a rgb color directly.
Specifically, I am trying to plot complex functions on the Riemann sphere. I can show the argument using the HSV color map (which is incorrectly named since it only shows hue, not saturation nor value):
sproj(x,y,z) = (x + I*y)/(1-z)
cf = lambda u,v: N(arg(-f(sproj(cos(u)*cos(v),sin(u)*cos(v),sin(v))))/(2*pi)+0.5)
cm = colormaps.hsv
parametric_plot3d((cos(s)*cos(t),sin(s)*cos(t),sin(t)), (s,-pi,pi),(t,-pi/2,pi/2), color = (cf,cm))
This does not show the modulus, though. I would like to be able to do something like this:
sproj(x,y,z) = (x + I*y)/(1-z)
cf = lambda u,v: complex_to_rgb(-f(sproj(cos(u)*cos(v),sin(u)*cos(v),sin(v))))
parametric_plot3d((cos(s)*cos(t),sin(s)*cos(t),sin(t)), (s,-pi,pi),(t,-pi/2,pi/2), color = cf)Jan HlavacekWed, 25 Jan 2017 19:43:23 +0100https://ask.sagemath.org/question/36386/Coloring surfaces in plot3dhttps://ask.sagemath.org/question/9068/coloring-surfaces-in-plot3d/I'm really new with sage, and what I would like is to color a graph from plot3d according to some function (specifically, I would want the hue to vary with the magnitude of the gradient). Is there some way of doing this easily?hihoWed, 12 Sep 2012 18:16:12 +0200https://ask.sagemath.org/question/9068/How to plot a 3D Triangle (prism) using parametric_plot3dhttps://ask.sagemath.org/question/33571/how-to-plot-a-3d-triangle-prism-using-parametric_plot3d/ I need to plot a 3d Triangle (prism), but i dont have any idea of how to make it. I try a lot of things but didn't work, please help me. ivanyosefSat, 28 May 2016 21:33:05 +0200https://ask.sagemath.org/question/33571/how to connect 2D polygons and show in 3D?https://ask.sagemath.org/question/29406/how-to-connect-2d-polygons-and-show-in-3d/ I'm very much a sage newbie so bear with me all! I'd like to learn how to arbitrarily connect regular 2D polygons together (as in a tesselation or partial polyhedral surface) and display that in 3D.
Thank you,
Chris Hoffmanchoff723Sat, 05 Sep 2015 18:25:18 +0200https://ask.sagemath.org/question/29406/Multiple 3D plots in one panel -> graphics_array and 3D?https://ask.sagemath.org/question/7896/multiple-3d-plots-in-one-panel-graphics_array-and-3d/Hello,
I am new to Sage and trying to learn as quickly as I can (I am a former Maple user).
I have been searching the reference docs, google group and the Net to find a way for putting multiple 3D plots in one panel, in a similar way as with graphics_array for 2D plots. Actually, I have not initially seen that graphics_array was only for 2D plots, and spent some time trying to make it work with my plots. When trying this, I was getting "raise TypeError, "every element of array must be a Graphics object" since the elements of my array are of type <class 'sage.plot.plot3d.base.Graphics3dGroup'>.
So, may question is the following: is there any trick that would allow me a to build a panel of 3D plots in a similar way as with graphics_array?
I would be very grateful if you could give me some hints on this problem.
Regards,
MuratmyildiTue, 25 Jan 2011 16:58:40 +0100https://ask.sagemath.org/question/7896/How to find the full argument list of a built-in function?https://ask.sagemath.org/question/25609/how-to-find-the-full-argument-list-of-a-built-in-function/My first use of Sage is utilizing its fantastic 3D plotting capabilities with Jmol. I am visualizing 3D curves from data points via line3d() and than using the show() method on the graphics objects. line3d? and show? give a short list of arguments such as color, thickness, radius for line3d, and frame for show. I know there are many more arguments, for example corner_cutoff for smoothing, but I only stumble upon them while browsing the Sage documentation. So far, I haven't found a source to list all the arguments for line3d or similar functions. I understand that these are Python wrappers and I tried things like dir() but I could not find more information than that given by line3d? Where am I going wrong? I am quite sure there are arguments controlling background color, the way frames and axes are labeled, etc. How can I find them? -Thanks.ikolTue, 27 Jan 2015 02:39:20 +0100https://ask.sagemath.org/question/25609/Jmol applet in Sage 6.3 cannot loadhttps://ask.sagemath.org/question/25374/jmol-applet-in-sage-63-cannot-load/ Hi,
I am going trough the Tutorial using Notebook. Under 3D plotting, I am trying to run the first example. The static 3D plot is generated but when I click "Make it Interactive", the Jmol applet fails to load. The error message says JmolApplet#0 has trouble loading, will try again. However, it fails loading. This is the Sage screen output I get:
java version "1.7.0_65"
OpenJDK Runtime Environment (IcedTea 2.5.3) (7u71-2.5.3-0ubuntu0.14.04.1)
OpenJDK 64-Bit Server VM (build 24.65-b04, mixed mode)
This application does not specify a Codebase in its manifest. Please verify with the applet's vendor. Continuing. See: http://docs.oracle.com/javase/7/docs/technotes/guides/jweb/security/no_redeploy.html for details.
Application title was not found in manifest. Check with application vendor
Application title was not found in manifest. Check with application vendor
script ERROR: script ERROR: io error reading http://localhost:8080/home/_sage_/30/cells/14/cells/14/sage0-size500-473909326.jmol.zip|SCRIPT: java.io.FileNotFoundException: http://localhost:8080/home/_sage_/30/cells/14/cells/14/sage0-size500-473909326.jmol.zip
I have Open JDK 7 and IcedTea installed on Ubuntu 14.04 (64-bit). If I go to the Jmol website www.jmol.org, I can run their demo and the Jmol applet IcedTea loads just fine in Firefox, it only doesn't work in the Sage Notebook.
Thanks for your help,
Istvan
ikolFri, 02 Jan 2015 06:56:49 +0100https://ask.sagemath.org/question/25374/