Yes, we've tested on OSX. For that demo the animation pops up in a new window-- I don't believe matplotlib animations are supported directly in jupyter notebooks.
As in that example code, to create an animated plot, use the
animate=True flag. For example:
hyp.plot(data, animate=True, chemtrails=True)
hi @esafak --
Let's try to separate out the various components of your setup. If you run a python session (not in a jupyter notebook-- just using
python from Terminal), can you try running the following three lines (after first running
pip install --upgrade hypertools prior to starting python, to make sure you have the latest version):
import hypertools as hyp x = hyp.tools.load('spiral') hyp.plot(x, animate=True, chemtrails=True, duration=10)
A new window should pop up with the animation, which should last for 10 seconds. After the animation finishes, you should be able to interact with the plot with your mouse. Can you let me know if this is what happens on your computer?
I just confirmed that this works on OSX, on both Python 2.7 and Python 3.5, with the version of hypertools that's on pip (0.1.7).
I only get this UserWarning, no animation or image
This call to matplotlib.use() has no effect because the backend has already been chosen; matplotlib.use() must be called *before* pylab, matplotlib.pyplot, or matplotlib.backends is imported for the first time. warnings.warn(_use_error_msg)
I also forgot to mention you forgot to include
requests in your
@esafak while static plots should work just fine, hypertools animations are not yet supported inside jupyter notebooks (but they should definitely work outside of the notebook). i've worked on this problem a bit, but its not implemented in the package. part of it is that you need a particular ffmpeg codec to animate inside a notebook: https://stackoverflow.com/questions/42133545/animations-in-ipython-jupyter-notebook-valueerror-i-o-operation-on-closed-f/43396335#43396335. The second piece is to detect that hypertools is being run within a notebook and then convert the line animation to html5 video (something like this):
if jupyter: from IPython.display import HTML HTML(line_ani.to_html5_video())
Today and tomorrow, hypertools is part of the Mozilla code sprint, and we will be working with the community to improve the package. If you are interested in helping with this piece, we'd be happy to have you, and i'd be happy to provide any guidance / answer any questions. let me know!
@jamalw you can use SRM to align the data from within hypertools:
SRM_aligned_data = hyp.tools.align(data, method='SRM')
It'd be strange (although perhaps not "wrong" per se) to then re-align the data using hyperalignment. Technically you could do that, though:
hyperaligned_and_SRM_aligned_data = hyp.tools.align(SRM_aligned_data)
@lmcinnes sure, we'd be happy with these additions! FYI, we have some changes pending to
cluster in ContextLab/hypertools#173 where we've changed some of the implementation details; also see ContextLab/hypertools#143. Overall, though, we'd be happy to have your help implementing these new algorithms (or wrappers for them)!
The place to start is to add GitHub issues (one for adding HDBSCAN to
cluster and another for adding UMAP to
reduce). Then I'd recommend tackling the issues separately-- either in separate forks or separate pull requests; this will allow us to incorporate changes from one issue independently of the other. Let me or @andrewheusser know if you'd like additional guidance!
%matplotlib inlinehere: https://colab.research.google.com/drive/10LoEodWC7PeMYfMnEf85eK97rXNtS7lh
%matplotlib notebookalso doesn't help.