How to plot3d in jupyter? see example in message

429 views
Skip to first unread message

jmarcell...@ufpi.edu.br

unread,
Jul 23, 2016, 8:53:03 PM7/23/16
to sage-cloud
w = vector([1, 0, 0]);
r = vector([0,1, 0]);
s = vector([0,0, 1]);

plot(w,color='red', figsize = (4,4), mesh=true, thickness=3)  + plot(r, thickness=3) + plot(s,color='green',thickness=3)

does not work in jupyter :(

William Stein

unread,
Jul 23, 2016, 8:58:33 PM7/23/16
to sage-cloud
I don't know how to draw rotatable 3d plots in Jupyter either.

The above will of course work fine in Sage worksheets.

-- William

>
> --
> You received this message because you are subscribed to the Google Groups
> "sage-cloud" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sage-cloud+...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sage-cloud/8b306b33-5b81-41a5-9e2c-93ee6f87c833%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



--

Best Regards,
William Stein

CEO, SageMath, Inc.

jmarcell...@ufpi.edu.br

unread,
Jul 24, 2016, 1:07:39 AM7/24/16
to sage-cloud
ok, ;) I thought it was possible to use in the jupyter.

William Stein

unread,
Jul 24, 2016, 1:10:48 AM7/24/16
to sage-...@googlegroups.com
You might try asking on the sage list as their isn't anything sagemathcloud specific really about this question.  Maybe somebody will provide some help. 
To view this discussion on the web visit https://groups.google.com/d/msgid/sage-cloud/85f6a1e4-a5c1-420d-9f0a-b032d42c90d7%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Eric Gourgoulhon

unread,
Jul 25, 2016, 10:41:03 AM7/25/16
to sage-cloud
Hi,

I am facing the same issue as you: I have many SageMath Jupyter notebooks with 3D plots that cannot be rendered in SMC. For standalone SageMath (i.e. outside SMC), 3D plots in Jupyter notebooks are rendered with JSmol (for instance your example works fine), but I understand that JSmol is not effective on SMC...

William: could the Three.js rendering that you created for SMC worksheets be used in Jupyter notebooks as well?

Best wishes,

Eric.

William Stein

unread,
Jul 25, 2016, 5:43:33 PM7/25/16
to sage-cloud
On Mon, Jul 25, 2016 at 7:41 AM, Eric Gourgoulhon
<egourg...@gmail.com> wrote:
> Hi,
>
> I am facing the same issue as you: I have many SageMath Jupyter notebooks
> with 3D plots that cannot be rendered in SMC. For standalone SageMath (i.e.
> outside SMC), 3D plots in Jupyter notebooks are rendered with JSmol (for
> instance your example works fine), but I understand that JSmol is not
> effective on SMC...
>
> William: could the Three.js rendering that you created for SMC worksheets be
> used in Jupyter notebooks as well?

No, it doesn't. With a week of solid work by somebody it would...

>
> Best wishes,
>
> Eric.
>
> Le dimanche 24 juillet 2016 07:07:39 UTC+2, jmarcell...@ufpi.edu.br a écrit
> :
>>
>> ok, ;) I thought it was possible to use in the jupyter.
>>
> --
> You received this message because you are subscribed to the Google Groups
> "sage-cloud" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sage-cloud+...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sage-cloud/8ccc3c24-a85e-47a6-b1f8-6c1148bc0506%40googlegroups.com.

Peter Luschny

unread,
Jul 28, 2016, 9:29:34 AM7/28/16
to sage-cloud
Hi all,

plot3d in jupyter is perhaps easy if one uses Asymptote  
http://asymptote.sourceforge.net/  which I recommend 
(not only for 3d plots, but as a vector graphics language). 
The resulting plots are far superior to other plotting methods
offered in connection with SageMath.

Now, and to make this SageMathCloud specific, there exists
an ipython-asymptote-magic. It would be very nice if this 
extension would be globally installed on SMC for yupyter
notebooks. However I am not sure if it already works with 
the latest jupyter version.

Cheers, Peter

Some links:


Harald Schilly

unread,
Jul 28, 2016, 9:45:28 AM7/28/16
to sage-cloud


On Thursday, July 28, 2016 at 3:29:34 PM UTC+2, Peter Luschny wrote:
Hi all,

plot3d in jupyter is perhaps easy if one uses Asymptote  


I made this https://github.com/sagemathinc/smc/issues/755 ... but I didn't really understand how this magic is going to be installed. Might not be too hard, though.

Besides that, it might also be neat to have %asy for sagews. I made that https://github.com/sagemathinc/smc/issues/756

-- h

William Stein

unread,
Jul 28, 2016, 2:03:26 PM7/28/16
to sage-cloud
On Thu, Jul 28, 2016 at 6:29 AM, Peter Luschny <peter....@gmail.com> wrote:
> Hi all,
>
> plot3d in jupyter is perhaps easy if one uses Asymptote
> http://asymptote.sourceforge.net/ which I recommend
> (not only for 3d plots, but as a vector graphics language).
> The resulting plots are far superior to other plotting methods
> offered in connection with SageMath.
>

Quick question can you interactively rotate 3d plots around?

> Now, and to make this SageMathCloud specific, there exists
> an ipython-asymptote-magic. It would be very nice if this

This?

https://github.com/jrjohansson/ipython-asymptote

> extension would be globally installed on SMC for yupyter
> notebooks. However I am not sure if it already works with
> the latest jupyter version.

Thanks for the tip!
> --
> You received this message because you are subscribed to the Google Groups
> "sage-cloud" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sage-cloud+...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sage-cloud/4bc140a0-764a-4099-93f6-154c7729ad8e%40googlegroups.com.

Peter Luschny

unread,
Jul 28, 2016, 7:02:44 PM7/28/16
to sage-cloud
> Quick question can you interactively rotate 3d plots around?

The output medium I use are pdf-files. This is perfect for my needs
as I embed the graphics in pdfLaTeX. Also using 3D interactively is 
possible in a pdf-file. 

To see how this works download 3D PDF samples and open them in 
Adobe Reader. You must save the file and NOT open the 3D PDF 
in your browser window. If you do, the model will NOT be interactive.

(which is an interpolation of Pascal's triangle, choose CAD-optimized light)
A complex example: the Turbine Engine from http://www.tetra4d.com/pdf-samples/

> > an ipython-asymptote-magic. 
> This? https://github.com/jrjohansson/ipython-asymptote

Yes.

Peter

Hal Snyder

unread,
Jul 29, 2016, 9:46:04 AM7/29/16
to sage-cloud
On Thursday, July 28, 2016 at 8:45:28 AM UTC-5, Harald Schilly wrote:

Note on running the Asymptote Jupyter extension in SMC added to the FAQ here:
Reply all
Reply to author
Forward
0 new messages