From d0a73eb862cf62a2e7dde414ab944a499903595b Mon Sep 17 00:00:00 2001 From: Nicolau Leal Werneck Date: Mon, 21 Oct 2019 23:03:44 +0200 Subject: [PATCH] Update pyplot.jl Adds a half-pixel margin to the extent for image plots so that the pixel coordinates match the grid, i.e. the center of each square pixel lies over its integral index numbers, and each square covers half a pixel before and after that. --- src/backends/pyplot.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backends/pyplot.jl b/src/backends/pyplot.jl index baa2d7b1..27ce9a4c 100644 --- a/src/backends/pyplot.jl +++ b/src/backends/pyplot.jl @@ -756,7 +756,7 @@ function py_add_series(plt::Plot{PyPlotBackend}, series::Series) cmap = py_colormap(cgrad([:black, :white])), vmin = 0.0, vmax = 1.0, - extent = (xmin, xmax, ymax, ymin) + extent = (xmin-0.5, xmax+0.5, ymax+0.5, ymin-0.5) ) push!(handles, handle)