CoCalc
Sharedsupport / 2014-11-19-pylab-svg.sagewsOpen in CoCalc

Examples for support purposes...

"""
Simple demo of a scatter plot.
"""
import numpy as np
import matplotlib.pyplot as plt


N = 50
x = np.random.rand(N)
y = np.random.rand(N)
colors = np.random.rand(N)
area = np.pi * (15 * np.random.rand(N))**2 # 0 to 15 point radiuses

plt.scatter(x, y, s=area, c=colors, alpha=0.5)
a=plt.show()  # now SVG by default
'\nSimple demo of a scatter plot.\n' <matplotlib.collections.PathCollection object at 0x7f3a6c3bcc10>
plt.show?
File: /projects/4a5f0542-5873-4eed-a85c-a18c706e8bcd/.sagemathcloud/sage_salvus.py
Signature : plt.show(svg=True)
Docstring :
Show a Pylab plot in a Sage Worksheet.

INPUTS:

   * svg -- boolean (default: True); if True use an svg;
     otherwise, use a png.
N = 50
x = np.random.rand(N)
y = np.random.rand(N)
colors = np.random.rand(N)
area = np.pi * (15 * np.random.rand(N))**2 # 0 to 15 point radiuses

plt.scatter(x, y, s=area, c=colors, alpha=0.5)
a=plt.show(svg=False)   # a png
<matplotlib.collections.PathCollection object at 0x7f3a69376650>