Closed flothesof closed 5 years ago
Oh, the warning is actually wrong in this case, Image is not meant to support 2D coordinate arrays at all. So the reason for the warning is because it's trying to find the sampling on a flattened version of the 2D coordinate arrays which are obviously not equally spaced.
How does Image determine if it's okay to be used?
I have an xarray with one dimension having slightly non-equidistant values, and I still get an Image by default, with above warning though (the spectral
coordinate is not strictly equidistant):
Versions:
arr.hvplot.image()
(which appears to be the default hvplot selectshere) checks to see if the coordinates explicitly encoded match the implicit coordinates computed by assuming equally spaced bins over the x and y ranges as Image rendering requires. If they match to within rtol, great!; otherwise you get a warning. If rtol is nearly ok and just needs to be a little more relaxed, feel free to increase rtol, but usually what it means is that an Image is inappropriate and you should use arr.hvplot.quadmesh()
instead.
hvplot.quadmesh() is NOT an adequad solution. It results in a ugly aliasing; see multiple comments: https://stackoverflow.com/questions/72448687/python-using-hvplot-quadmesh-for-xarray-data-shows-blended-colors-in-a-plot https://discourse.holoviz.org/t/how-to-stop-param-image-warning/2934 https://discourse.holoviz.org/t/hvplot-reporting-inconsistent-chunks-on-xarray-dataarray/1690
hvplot.quadmesh() is NOT an adequad solution. It results in a ugly aliasing; see multiple comments: https://stackoverflow.com/questions/72448687/python-using-hvplot-quadmesh-for-xarray-data-shows-blended-colors-in-a-plot https://discourse.holoviz.org/t/how-to-stop-param-image-warning/2934 https://discourse.holoviz.org/t/hvplot-reporting-inconsistent-chunks-on-xarray-dataarray/1690
your links are broken?
now the links should work. I edited the post
Hey there, I'm trying to plot functions using the hv.Image element. I keep getting this warning:
Here's my sample code:
I tried following the recommandations about rtol. But even something like
hv.Image((X, Y, Z), rtol=1.)
will still give the warning, which I don't understand since my data is equally spaced.As a side note, this works nicely with QuadMesh (hat-tip to the good warning!), but QuadMesh with the Bokeh backend displays gray cell borders which I don't want.
Thanks for your help.
Regards, Florian