| 1 |
#!/usr/bin/python3 |
| 2 |
|
| 3 |
import warnings |
| 4 |
import numpy as np |
| 5 |
import matplotlib.pyplot as plt |
| 6 |
import mpl_scatter_density # noqa |
| 7 |
|
| 8 |
warnings.filterwarnings("ignore") |
| 9 |
|
| 10 |
fig = plt.figure() |
| 11 |
ax = fig.add_subplot(1, 1, 1, projection='scatter_density') |
| 12 |
|
| 13 |
n = 10000000 |
| 14 |
|
| 15 |
x = np.random.normal(0.5, 0.3, n) |
| 16 |
y = np.random.normal(0.5, 0.3, n) |
| 17 |
|
| 18 |
ax.scatter_density(x, y, color='red') |
| 19 |
|
| 20 |
x = np.random.normal(1.0, 0.2, n) |
| 21 |
y = np.random.normal(0.6, 0.2, n) |
| 22 |
|
| 23 |
ax.scatter_density(x, y, color='blue') |
| 24 |
|
| 25 |
ax.set_xlim(-0.5, 1.5) |
| 26 |
ax.set_ylim(-0.5, 1.5) |
| 27 |
|
| 28 |
fig.savefig('double.png') |