Skip to content

Better default bounds for Image #1534

@drs251

Description

@drs251

Currently, the default behavior for Image is to apply bounds of +-0.5 to both axes. If the original data is not square shaped, the result is a distorted image, as shown below:

%%opts Image (cmap="gray") [aspect='equal']
import holoviews as hv
from scipy import misc
face = misc.face(gray=True)
hv.Image(face)

image

The original image was 1024x768, but is now shown squashed. When no bounds are specified, the bounds should be set so that the data's original aspect ratio is preserved, e.g. something like this:

  1. Set bounds on x axis to -0.5 and +0.5
  2. Set bounds on y axis to -a and +a, where a=data.shape[1]/data.shape[0]*0.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions