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.Mon, 20 Apr 2020 14:14:55 +0200plot3d 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.Tue, 25 Feb 2020 11:37:40 +0100https://ask.sagemath.org/question/50051/plot3d-method-does-not-properly-work-with-threejs/Comment by eric_g for <p>The <code>plot3d</code> 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>
<pre><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")
</code></pre>
<p>yields this result:</p>
<p><img alt="image description" src="/upfiles/1582626986673771.png"></p>
<p>The first graphic, corresponding to jmol, is correct. The second graphic, produced by threejs, is completely wrong.</p>
https://ask.sagemath.org/question/50051/plot3d-method-does-not-properly-work-with-threejs/?comment=50875#post-id-50875The issue reported in the original question is fixed in the release candidate of SageMath 9.1 (to be out soon).Mon, 20 Apr 2020 14:14:55 +0200https://ask.sagemath.org/question/50051/plot3d-method-does-not-properly-work-with-threejs/?comment=50875#post-id-50875Comment by rburing for <p>The <code>plot3d</code> 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>
<pre><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")
</code></pre>
<p>yields this result:</p>
<p><img alt="image description" src="/upfiles/1582626986673771.png"></p>
<p>The first graphic, corresponding to jmol, is correct. The second graphic, produced by threejs, is completely wrong.</p>
https://ask.sagemath.org/question/50051/plot3d-method-does-not-properly-work-with-threejs/?comment=50060#post-id-50060Doing `sum(parametric_plot3d([x,(5-k)*sin(x), k], (x, 0, 10)) for k in range(6))` gives the same result in both viewers, but `threejs` doesn't seem to like this `thickness` or `color`.Tue, 25 Feb 2020 16:09:32 +0100https://ask.sagemath.org/question/50051/plot3d-method-does-not-properly-work-with-threejs/?comment=50060#post-id-50060Comment by Juanjo for <p>The <code>plot3d</code> 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>
<pre><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")
</code></pre>
<p>yields this result:</p>
<p><img alt="image description" src="/upfiles/1582626986673771.png"></p>
<p>The first graphic, corresponding to jmol, is correct. The second graphic, produced by threejs, is completely wrong.</p>
https://ask.sagemath.org/question/50051/plot3d-method-does-not-properly-work-with-threejs/?comment=50084#post-id-50084Certainly it is possible to search workarounds. But what I just wanted is to draw attention to the fact that the default viewer does not behave properly in the described situation. The example given in the docs (search for plot3d in [this page](http://doc.sagemath.org/html/en/reference/plotting/sage/plot/graphics.html)) does not longer work. Perhaps somebody who knows to open trac tickets could add one on this issue.Wed, 26 Feb 2020 23:45:06 +0100https://ask.sagemath.org/question/50051/plot3d-method-does-not-properly-work-with-threejs/?comment=50084#post-id-50084Comment by eric_g for <p>The <code>plot3d</code> 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>
<pre><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")
</code></pre>
<p>yields this result:</p>
<p><img alt="image description" src="/upfiles/1582626986673771.png"></p>
<p>The first graphic, corresponding to jmol, is correct. The second graphic, produced by threejs, is completely wrong.</p>
https://ask.sagemath.org/question/50051/plot3d-method-does-not-properly-work-with-threejs/?comment=50088#post-id-50088This is now https://trac.sagemath.org/ticket/29251.
Thanks for having reported this bug!Thu, 27 Feb 2020 13:46:57 +0100https://ask.sagemath.org/question/50051/plot3d-method-does-not-properly-work-with-threejs/?comment=50088#post-id-50088Comment by ortollj for <p>The <code>plot3d</code> 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>
<pre><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")
</code></pre>
<p>yields this result:</p>
<p><img alt="image description" src="/upfiles/1582626986673771.png"></p>
<p>The first graphic, corresponding to jmol, is correct. The second graphic, produced by threejs, is completely wrong.</p>
https://ask.sagemath.org/question/50051/plot3d-method-does-not-properly-work-with-threejs/?comment=50786#post-id-50786sagemath notebook 9.0 ,OS Ubuntu 18.04
yes threejs do not care about color.
a = vector([1, 2,5])
b = vector([4, 3,3])
plot(a, color='red')
P=plot(a, color='red') + plot(b, color='blue') + plot(a + b, color='black')
show(P, viewer="jmol")
show(P, viewer="threejs")
moreover both viewer do not accept 2d vectors
a = vector([1, 2])
b = vector([4, 3])
plot(a, color='red')
P=plot(a, color='red') + plot(b, color='blue') + plot(a + b, color='black')
show(P, viewer="jmol")
show(P, viewer="threejs")
**matplotlib() got an unexpected keyword argument 'viewer'**Thu, 16 Apr 2020 10:24:50 +0200https://ask.sagemath.org/question/50051/plot3d-method-does-not-properly-work-with-threejs/?comment=50786#post-id-50786