Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Holoviews: Plot frame(s) dimensions and aspect ratio

I am currently desperately trying out to align three images with different sizes in a gridlike layout.

Essentially, I would like to insert three raster images of different shapes. I would like to be able to define their boundary and aspect ratio of each raster independently that they are not stretched in one dimension. However, I fail to find a fix doing that.

My code snipplet:

import holoviews as hv
import numpy as np
hv.extension('bokeh')
%%opts Raster [show_frame=False shared_axes=False]

hv.Layout(hv.Raster(np.eye(100,100),group='t1') +
 hv.Raster(np.eye(100,20),group='t2') + 
 hv.Raster(np.eye(20,100),group='t3')).cols(2)

Which produces the following: Sample Image

Is there any way to define each raster image bounding box individually in a layout?

Thanks in advance!

like image 496
Sasa_3 Avatar asked Nov 21 '25 01:11

Sasa_3


1 Answers

I found the solution after searching through the API.

width and height can be adjusted individually by opts:

hv.Raster(np.eye(100,100),group='t1').opts(plot=dict(width=500, height=500))
like image 100
Sasa_3 Avatar answered Nov 22 '25 14:11

Sasa_3