holoviews icon indicating copy to clipboard operation
holoviews copied to clipboard

Improve error message for non-matching types with aspect set to equal

Open hoxbro opened this issue 4 months ago • 1 comments

Fixes https://github.com/holoviz/holoviews/issues/6089

This can create the Matplotlib problem without rasterize. rasterize will have an Image aspect set to 'equal', whereas Quadmesh have an aspect set to square.

I have chosen to raise a TypeError instead of adding custom logic as it does not really make sense to take the equal of an axis with numbers and an axis with timedelta. An alternative could be to set the aspect to 1.

import holoviews as hv
import numpy as np
import pandas as pd

hv.extension("matplotlib")

X = pd.date_range(start="1/1/2018", end="1/08/2018", periods=100)
Y = np.linspace(1, 100, 100)
Z = np.random.randn(100, 100)

hv.QuadMesh((X, Y, Z)).opts(aspect='equal')

TODO

  • [ ] Improve plotly
  • [ ] Add tests

hoxbro avatar Feb 06 '24 20:02 hoxbro