You are reading an old version of the documentation (v1.5.1). For the latest version see

We're updating the default styles for Matplotlib 2.0

Learn what to expect in the new updates



This Page

pylab_examples example code: scatter_masked.pyΒΆ

(Source code, png, hires.png, pdf)

import matplotlib.pyplot as plt
import numpy as np

N = 100
r0 = 0.6
x = 0.9*np.random.rand(N)
y = 0.9*np.random.rand(N)
area = np.pi*(10 * np.random.rand(N))**2  # 0 to 10 point radiuses
c = np.sqrt(area)
r = np.sqrt(x*x + y*y)
area1 = < r0, area)
area2 = >= r0, area)
plt.scatter(x, y, s=area1, marker='^', c=c, hold='on')
plt.scatter(x, y, s=area2, marker='o', c=c)
# Show the boundary between the regions:
theta = np.arange(0, np.pi/2, 0.01)
plt.plot(r0*np.cos(theta), r0*np.sin(theta))

Keywords: python, matplotlib, pylab, example, codex (see Search examples)