holoviz / holoviews

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

(Log-)transformed data axes #2984

Open poplarShift opened 6 years ago

poplarShift commented 6 years ago

I've been searching high and low (I think) for a way to plot a given variable with some transformation, e.g. log-transform. Something like %%opts Points [logx=True] is not feasible e.g. in a gridmatrix where the Dimension occupies variable axes of the figure.

import numpy as np
import holoviews as hv
hv.extension('bokeh')
from holoviews.operation import gridmatrix
d=np.c_[np.random.rand(50,3),10**np.random.rand(50,1)]
ds=hv.Dataset(d,vdims=['u','x','y','z'])
gridmatrix(ds,chart_type=hv.Points)

Are there plans to implement this, I'm thinking e.g. in hv.Dimension or otherwise when declaring the dataset? How hard would it be?

philippjfr commented 6 years ago

I do think this is something we could consider but it would require some discussion. Do you have any suggestions on how to declare it? Something like:

hv.Dimension('x', transform='linear'/'log'/'cbrt')

and what transforms would you expect to be exposed?

poplarShift commented 6 years ago

I guess the most flexible way would be to let the user supply a norm object to the transform= keyword along the lines of https://matplotlib.org/users/colormapnorms.html where norm(original_data) either maps a fixed [vmin,vmax] data interval to [0,1] (or just supplies a transformation function new_data=norm(original_data)). For custom transforms the vmin,vmax mean a cutoff, but for linear or log or power law transforms these can be extended dynamically as one zooms in or out.

As far as exposing through keywords goes, log transforms would already go a long way.