ContextLab / hypertools

A Python toolbox for gaining geometric insights into high-dimensional data
http://hypertools.readthedocs.io/en/latest/
MIT License
1.83k stars 160 forks source link

bug: multicolored lines #86

Closed jeremymanning closed 7 years ago

jeremymanning commented 7 years ago

When plotting a line with the group flag, gaps appear in the lines wherever there are color changes (see attached figure). To reproduce:

import hypertools as hyp import numpy as np from scipy.io import loadmat data = loadmat('test_data.mat') #from sample_data hyp.plot(data['spiral'], group=np.arange(1000))

The expected behavior would be to produce a contiguous line without gaps.

gaps

andrewheusser commented 7 years ago

fixed on f44a6e0

figure_1

jeremymanning commented 7 years ago

this doesn't work quite right with animate=True: import hypertools as hyp import numpy as np from scipy.io import loadmat data = loadmat('test_data.mat') #from sample_data hyp.plot(data['spiral'], group=np.arange(1000), animate=True)

expected behavior: the spiral should appear in chunks, like for hyp.plot(data['spiral'], animate=True) except that the different parts of the spiral should appear in colors like in the static plot

observed behavior: parts of the entire spiral appear, but as dots, and it looks like those same dots stay in place as the camera rotates around them. not sure if this is related to the fix or if it's a new issue...

andrewheusser commented 7 years ago

i think what is happening here is that each 'group' is being drawn simultaneously - which makes sense for plotting, say, multiple subjects data at one time, but not for situations like this. under the hood, group divides the data up into len(unique(group)) chunks, and plots them one at a time with matplotlib. we could change the default behavior when using the group kwarg to plot the arrays sequentially. thoughts? I think this is unrelated to the bug fix, so i can open a new issue

jeremymanning commented 7 years ago

:+1:

jeremymanning commented 7 years ago

ah-- i just read your comment in more detail. you're right about what's happening, i think...and i think it's actually the correct behavior. but we probably want to add in the option to plot groups simultaneously or sequentially. however, that would be an enhancement (not a bug fix), so i'm going to close this issue since that functionality is already covered in one of the v2 feature ideas.

andrewheusser commented 7 years ago

cool, it does seem like the default behavior for group should be to plot sequentially (I think). but we can def support both in v2

jeremymanning commented 7 years ago

i'm not sure we want groups to plot sequentially by default (e.g. for the weights.mat examples we want simultaneous plotting). i think simultaneous is as good a default as any, but we should just add an option to change to sequential plotting on demand.

andrewheusser commented 7 years ago

yea you are right - we'll just add an option to plot sequentially