CoCalc -- Collaborative Calculation in the Cloud
Sharedsupport / 2016-09-23-104428-issue234.sagewsOpen in CoCalc

Examples for support purposes...

Related to https://github.com/sagemathinc/smc/issues/234

r2 = jupyter('ir')




%r2
plot(rnorm(100))
%r2

plot(rnorm(100))
plot(rnorm(100))
jpeg(width=300)
plot(rnorm(100))
pdf()
plot(rnorm(100))
plot(rnorm(100))
cairo_pdf(onefile=FALSE)
plot(rnorm(100))
plot(rnorm(100))
svg(filename="Custom.svg")
plot(rnorm(100))
jupyter?
File: /projects/sage/sage-7.3/local/lib/python2.7/site-packages/smc_sagews/sage_jupyter.py
Signature : jupyter(**kwds)
Docstring :
Use the jupyter command to use any Jupyter kernel that you have
installed using from your SageMathCloud worksheet

      py3 = jupyter("python3")

After that, begin a sagews cell with %py3 to send statements to the
Python3 kernel that you just created:

      %py3
      print(42)

You can even draw graphics.

      %py3
      import numpy as np; import pylab as plt
      x = np.linspace(0, 3*np.pi, 500)
      plt.plot(x, np.sin(x**2))
      plt.show()

You can set the default mode for all cells in the worksheet. After
putting the following in a cell, click the "restart" button, and
you have an anaconda worksheet.

      %auto
      anaconda3 = jupyter('anaconda3')
      %default_mode anaconda3

Each call to jupyter creates its own Jupyter kernel. So you can
have more than one instance of the same kernel type in the same
worksheet session.

      p1 = jupyter('python3')
      p2 = jupyter('python3')
      p1('a = 5')
      p2('a = 10')
      p1('print(a)')   # prints 5
      p2('print(a)')   # prints 10

For details on supported features and known issues, see the SMC
Wiki page: https://github.com/sagemathinc/smc/wiki/sagejupyter

Available kernels:

sagemath          /projects/sage/sage-7.3/local/share/jupyter/kernels/sagemath
anaconda3         /usr/local/share/jupyter/kernels/anaconda3
bash              /usr/local/share/jupyter/kernels/bash
ir                /usr/local/share/jupyter/kernels/ir
julia             /usr/local/share/jupyter/kernels/julia
octave            /usr/local/share/jupyter/kernels/octave
python2           /usr/local/share/jupyter/kernels/python2
python2-ubuntu    /usr/local/share/jupyter/kernels/python2-ubuntu
python3           /usr/local/share/jupyter/kernels/python3
sage-develop      /usr/local/share/jupyter/kernels/sage-develop
spark-anaconda    /usr/local/share/jupyter/kernels/spark-anaconda
spark-sagemath    /usr/local/share/jupyter/kernels/spark-sagemath