datashader icon indicating copy to clipboard operation
datashader copied to clipboard

0.6.2 Offset question.

Open apiszcz opened this issue 8 years ago • 1 comments

Review of raw input data points against three methods of density counting. DataShader appears to have an offset. The input data (33 records) CSV zip file is attached.

DataShader 0.6.2, Cell size is 0.0005 degrees image

Custom Method, Cell size is 0.0005 degrees image

ESRI ArcMap, Cell size is 0.0005 (~50 meters), Search Rectangle 0.0005 degrees image

f2.zip

apiszcz avatar Nov 19 '17 14:11 apiszcz

I am entirely happy with what datashader 0.14.2 is doing with this data. Example code:

from bokeh.models import ColorBar, LinearColorMapper
from bokeh.palettes import Spectral
from bokeh.plotting import figure, show
import datashader as ds
import pandas as pd

df = pd.read_csv("f2.csv")

# Canvas size in data units
dx = 0.0005
xmin = 0
xmax = 2*dx
npixels = 4

cvs = ds.Canvas(plot_width=npixels, plot_height=npixels, x_range=(xmin, xmax), y_range=(xmin, xmax))
agg = cvs.points(df, x="lon", y="lat")
print(agg)
max_count = agg.max().item()

p = figure(width=500, height=400)
color_mapper = LinearColorMapper(palette=Spectral[max_count+1], low=-0.5, high=max_count+0.5)
p.image([agg.to_numpy()], x=xmin, y=xmin, dw=xmax-xmin, dh=xmax-xmin, color_mapper=color_mapper)

color_bar = ColorBar(color_mapper=color_mapper)
p.add_layout(color_bar, "right")

p.circle(x="lon", y="lat", source=df, color="black", size=10)

show(p)

Output: Screenshot 2022-09-05 at 15-52-05 Bokeh Plot

You can alter xmin, xmax and npixels are it all looks entirely consistent.

Given that there is no evidence of an offset and the original post is 5 years old, I am happy to close this issue.

ianthomas23 avatar Sep 05 '22 14:09 ianthomas23