holoviz / holoviews

With Holoviews, your data visualizes itself.
https://holoviews.org
BSD 3-Clause "New" or "Revised" License
2.71k stars 403 forks source link

GridMatrix and aspect ratio of Raster #591

Open vascotenner opened 8 years ago

vascotenner commented 8 years ago

When a holomap with Raster objects is displayed as a grid, the aspect of the objects is not obeyed.

Example:

hmap = hv.HoloMap({(0,5):hv.Raster(np.random.randn(5,5)),
            (0,50):hv.Raster(np.random.randn(50,50)),
           (1,5):hv.Raster(np.random.randn(5,5)),
            (1,50):hv.Raster(np.random.randn(50,50)),}, kdims=['K1','K2'])
hmap.grid(['K2','K1'])

I would expect: download

But I get: download 1

This works fine with hv.Images though.

vascotenner commented 8 years ago

My temporal solution is:

hmap.layout().cols(2)
philippjfr commented 8 years ago

Thanks for reporting this, currently there are two implementations for GridPlot one for Raster types and one for all other types. The Raster version draws everything onto one axis and takes into account extents and aspect ratios while the regular version will not. For consistency we should probably have the Raster version ignore the aspect ratio of the plots and provide a plot option to take it into account.

philippjfr commented 8 years ago

Note to avoid this you can do this:

from holoviews import GridSpace
from holoviews.plotting.mpl.plot import GridPlot
hv.Store.register({GridSpace: GridPlot}, 'matplotlib')

I think we should do this in general for consistency and only use the RasterGridPlot version in Topographica.