lmcinnes / umap

Uniform Manifold Approximation and Projection
BSD 3-Clause "New" or "Revised" License
7.44k stars 808 forks source link

subset_points not working for interactive plots #361

Open IA-Cardiologia-husa opened 4 years ago

IA-Cardiologia-husa commented 4 years ago

Hi!

First of all, thank you so much for this amazing library.

I have noticed a little issue while plotting a subset of points with interactive plots. In the function interactive of umap/plot.py [LINE 1268] instead of:

points = umap_object.embedding_
    if subset_points:
        points = points[subset_points]

I think it would be better to just use:

as you do in the points function:

if subset_points is not None:
        if len(subset_points) != points.shape[0]:
            raise ValueError(
                "Size of subset points ({}) does not match number of input points ({})".format(
                    len(subset_points), points.shape[0]
                )
            )

        data = data[subset_points]
        if hover_data is not None:
            hover_data = hover_data[subset_points]

Thanks

lmcinnes commented 4 years ago

I agree -- I'll try to get that added shortly; or you are welcome to submit a pull request if you would like it sooner.