To simplify your question, you have two sets of points: one for ping <1000, one for ping> = 1000. Since the number of points is very large, you cannot build them directly using the scatter () method. I created some sample data:
longs = (np.random.rand(60, 1) + np.linspace(-np.pi, np.pi, 80000)).reshape(-1) lats = np.sin(longs) + np.random.rand(len(longs)) * 0.1 bad_index = (longs>0) & (longs<1) bad_longs = longs[bad_index] bad_lats = lats[bad_index]
(longs, lats) are points for ping <1000, (bad_longs, bad_lats) are points for ping> 1000
You can use numpy.histogram2d () for scoring:
ranges = [[np.min(lats), np.max(lats)], [np.min(longs), np.max(longs)]] h, lat_range, long_range = np.histogram2d(lats, longs, bins=(400,400), range=ranges) bad_h, lat_range2, long_range2 = np.histogram2d(bad_lats, bad_longs, bins=(400,400), range=ranges)
h and bad_h - scoring in each small area of ββthe scraper.
Then you can select many methods for visualization. For example, you can build it using the scatter () method:
y, x = np.where(h) count = h[y, x] pl.scatter(long_range[x], lat_range[y], s=count/20, c=count, linewidths=0, cmap="Blues") count = bad_h[y, x] pl.scatter(long_range2[x], lat_range2[y], s=count/20, c=count, linewidths=0, cmap="Reds") pl.show()
Here is the complete code:
import numpy as np import pylab as pl longs = (np.random.rand(60, 1) + np.linspace(-np.pi, np.pi, 80000)).reshape(-1) lats = np.sin(longs) + np.random.rand(len(longs)) * 0.1 bad_index = (longs>0) & (longs<1) bad_longs = longs[bad_index] bad_lats = lats[bad_index] ranges = [[np.min(lats), np.max(lats)], [np.min(longs), np.max(longs)]] h, lat_range, long_range = np.histogram2d(lats, longs, bins=(300,300), range=ranges) bad_h, lat_range2, long_range2 = np.histogram2d(bad_lats, bad_longs, bins=(300,300), range=ranges) y, x = np.where(h) count = h[y, x] pl.scatter(long_range[x], lat_range[y], s=count/20, c=count, linewidths=0, cmap="Blues") count = bad_h[y, x] pl.scatter(long_range2[x], lat_range2[y], s=count/20, c=count, linewidths=0, cmap="Reds") pl.show()
Output indicator:
