コード例 #1
0
import os
import sys

import numpy as np

import matplotlib.pyplot as plt

from raster_axes import RasterAxes

from astropy.visualization import LogStretch
from astropy.visualization.mpl_normalize import ImageNormalize

norm = ImageNormalize(vmin=0., vmax=1000, stretch=LogStretch())

fig = plt.figure()
ax = RasterAxes(fig, [0.1, 0.1, 0.8, 0.8], aspect='equal')
fig.add_axes(ax)

xmin = -8240227.037
ymin = 4974203.152
xmax = -8231283.905
ymax = 4979238.441

if not os.path.exists('taxi.npz'):
    print("You need to run the convert_nyc.py script first")
    sys.exit(1)

arrays = np.load('taxi.npz')
x = arrays['x']
y = arrays['y']
コード例 #2
0
import numpy as np

import matplotlib.pyplot as plt

from raster_axes import RasterAxes

fig = plt.figure()
ax = RasterAxes(fig, [0.1, 0.1, 0.8, 0.8])
fig.add_axes(ax)

n = 1000000
x = np.random.normal(0.5, 0.3, n)
y = np.random.normal(0.5, 0.3, n)

ax.rasterized_scatter(x, y, color='red')

n = 1000000
x = np.random.normal(0.5, 0.2, n)
y = np.random.normal(0.5, 0.2, n)

ax.rasterized_scatter(x, y, color='green')

fig.canvas.draw()
コード例 #3
0
import numpy as np

import matplotlib.pyplot as plt

from raster_axes import RasterAxes

from astropy.visualization import LogStretch
from astropy.visualization.mpl_normalize import ImageNormalize

norm = ImageNormalize(vmin=0., vmax=1000, stretch=LogStretch())

fig = plt.figure()
ax = RasterAxes(fig, [0.1, 0.1, 0.8, 0.8])
fig.add_axes(ax)

n = 10000000
x = np.random.normal(0.5, 0.3, n)
y = np.random.normal(0.5, 0.3, n)

ax.rasterized_scatter(x, y, colormap='viridis', norm=norm)

plt.show()