holoviz / holoviews

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

QuadMesh bin edges getting munged? #2232

Closed txlouder closed 6 years ago

txlouder commented 6 years ago

Hi,

QuadMesh seems to be altering/adjusting/munging the bin edges supplied. See trivial example below where I create a QuadMesh with one set of bin edges. When I subsequently read out the edges, they are a completely different set. Only the first and last bin edges are unaltered.

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

x = np.array(sorted(1000*np.random.random(10))) ​ for i in range(len(x)): print('%20.6f' % x[i])

      156.398070
      283.736783
      390.115061
      552.175220
      554.453313
      554.784756
      610.334261
      813.045554
      959.768363
      999.989470

y = np.ones(10) ​z = np.ones([10,10]) ​qm = hv.QuadMesh((x, y, z), ['x', 'y'], ['z']) ​ for i in range(len(x)): print('%20.6f %20.6f' % (x[i], qm['x'][i]))

      156.398070           156.398070
      283.736783           278.496674
      390.115061           404.035531
      552.175220           512.229703
      554.453313           553.966650
      554.784756           568.589271
      610.334261           647.124708
      813.045554           799.048433
      959.768363           933.142938
      999.989470           999.989470`
ea42gh commented 6 years ago
np.random.seed(123)
x = np.array(sorted(1000*np.random.random(10)))
y = np.linspace(0,9,10)
z = np.random.normal(size=(10,10))

yields even more puzzling y-values and white stripes, e.g., at x=600 and x=800

jlstevens commented 6 years ago

Thanks for reporting this.

QuadMesh has recently been given a new data interface so it looks like there may be some issues there. I agree explicitly supplied bin edges should not be changed if possible.

philippjfr commented 6 years ago

Could you confirm which version you are using? Using master your example seems to come out okay @ea42gh:

That said @txlouder, I can reproduce your issue. I suspect it has something to do with the way edges and bin centers are handled so I've marked it as a bug.

Actually sorry, the exact inverse is true, I hadn't checked out master myself. @ea42gh I can reproduce your issue and @txlouder your issue seems to be resolved in master if you use the following

for i in range(len(x)): print('%20.6f %20.6f' % (x[i], qm.dimension_values(0, expanded=False)[i]))

qm['x'] behavior has seemingly changed since it was inconsistent with the way other elements behaved.

philippjfr commented 6 years ago

After #2237 everything mentioned in this issue is now behaving like I'd expect.

github-actions[bot] commented 2 weeks ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.