-
Notifications
You must be signed in to change notification settings - Fork 10
Description
Hi @richteague,
There is an issue (or my misunderstanding) with a teardrop plot extent. The extent keyword in the matplotlib's imshow sets the location of the image borders, not the location of the image corner pixels' centers.
In your case, rvals are the locations of the bin centers, right? For example, the can be:
2.01438614 2.3242917 2.63419726 2.94410282 3.25400838 3.56391393
3.87381949 4.18372505 4.49363061 4.80353617 5.11344173 5.42334729
5.73325285 6.04315841 6.35306397 6.66296953 6.97287509 7.28278065
That namely means that the pixel centers are (I will round) 0.15, 0.45, 0.75, ..., with a pixel size 0.3. In this case, the desired extent in the radial coordinate will be from the first rval - 0.15 to the last rval + 0.15.
If you want to keep imshow, the extent should be changed to:
velstep = velax[1] - velax[0]
rstep = rvals[1] - rvals[0]
extent = [velax[0] - velstep / 2, velax[-1] + velstep / 2,
rvals[0] - rstep / 2, rvals[-1] + rstep / 2]The corresponding tutorial: https://matplotlib.org/3.1.1/tutorials/intermediate/imshow_extent.html
I would propose though to use the method pcolormesh, as it also can handle not-uniform coordinate steps. (shading='gourand') can be used if the coordinates are left as is, or the coordinates can be rewritten to correctly match the edges of the pixels.
https://matplotlib.org/3.1.1/api/_as_gen/matplotlib.pyplot.pcolormesh.html
Best,
Greg