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

arrays with one row are omitted if using line plot #192

Closed andrewheusser closed 6 years ago

andrewheusser commented 6 years ago

to replicate this issue:

import hypertools as hyp
import numpy as np

data = [np.random.rand(1, 10) for i in range(10)]
hyp.plot(data)

show's up as a blank plot, however hyp.plot(data, '.') plots the data as points. The issue is that an array with a single row (and thus a single coordinate) cannot be plotted as a line (matplotlib draws nothing in this case). This issue also comes up when passing text data as a list of strings:

text = ['some text', 'more text', 'some other text']
hyp.plot(text) # nothing shows up
hyp.plot(text, '.') # this works

one way to overcome this would be to check to see if each array has a single row, and if it does modify the format string to be a point, unless its already specified as such