lmcinnes / lmcinnes/umap

Making a subplot figure with umap.plot objects

Open
#481 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
8.3k
Forks
871
Avg merge
1d 13h
Merged PRs (30d)
5

Description

I know that umap.plot return matplotlib.pyplot axes but I cannot get my head around making a subplot (as in a 2D array of `umap.plot`s)

I am trying:

```python
import matplotlib.pyplot as plt
import umap.plot
import umap
import sklearn.datasets

pendigits = sklearn.datasets.load_digits()

fig, axs = plt.subplots(2,2,figsize = (10,10))
for r in range(1):
for c in range(1):
mapper = umap.UMAP(n_neighbors = ((r+c) + 1)*5, spread = ((r+c)+1)*2).fit(pendigits.data)
axs[r,c] = umap.plot.points(mapper, labels = pendigits.target)

plt.show()
fig.savefig('fig.png')
```

I am simply getting one `umap.plot` and an empty 2x2 grid, what am I doing wrong?

Contributor guide

Open the contributing guide

Research direction

Start with the provided matplotlib.pyplot subplots loop and the umap.plot.points call; inspect how the plotting entry point uses axes and compare that with the axs[r,c] array. Reproduce the 2x2 example, then verify that every subplot is populated and that the saved figure contains all panels.

Written by the indexing model from the issue text.

Assessment

Tech stack
matplotlib, python
Domain
data-visualization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.