lmcinnes / lmcinnes/umap

umap.plot.connectivity issue with plotting colours for categories

Open
#362 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
8.3k
Forks
871
Avg merge
1d 13h
Merged PRs (30d)
5

Description

Hello,

I am having some trouble plotting a umap with different colours for categories. I am using the umap.plot.connectivity as I am plotting with hammer for edge bundling:

My code to generate the plot is as follows:

`meta = pd.read_csv("metadata.csv")

mapper = umap.UMAP().fit(counts.transpose())

##plot points
x=umap.plot.points(mapper, labels=meta["Organ"])

**please note plot.points DOES colour all organs appropriately**

**not when i plot connectivity**

##with connectivity

umap.plot.connectivity(mapper, edge_bundling="hammer",
cmap="rainbow", )`

This produces the plot attached to this post

[hammer distance.pdf](https://github.com/lmcinnes/umap/files/4234951/hammer.distance.pdf)

I have different combinations of patterns in the arguments including edge_cmap, show_points, color_key and color_key_cmap with no success!

Any help would be much appreciated!!

Additionally, are there ways of further customising the plot, add title, remove borders etc.. I am having trouble passing this object to matplotlib arguments downstream of this.

many thanks!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the shown Python example with umap.plot.points and umap.plot.connectivity, including edge_bundling="hammer", and compare how category colours are applied. Check whether the connectivity plot exposes the matplotlib customisation requested; done means category colours remain consistent and the resulting plot can be customised as described.

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
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.