question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

plt.colorbar support for umap.plot.points

See original GitHub issue

Hello, umap.plot.points does not seem to support a colour bar when colouring the points with continuous values, is this a design choice?

I’ve tried

umap.plot.points(umap_object, values = array_of_numbers)
plt.colorbar()

With no success.

I think it’d be quite handy to have such functionality

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:2
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
zachschillaci27commented, Mar 7, 2022

Hi @lucharo , not sure if your issue is still outstanding, but I recently ran into a similar problem myself. I implemented a quick workaround which I will share below.

First create a pcolormesh for the series which you will be coloring with umap:

psm = plt.pcolormesh([data_series, data_series], cmap=mpl.cm.get_cmap('viridis'))

Then create the umap points plot as usual, ensuring the data series and color theme are the same:

ax = umap.plot.points(mapper, values=data_series, theme='viridis')

Now create the colorbar from the pcolormesh and draw alongside the umap figure:

cb = plt.colorbar(psm, ax=ax)

From here you can edit the colorbar object as you please to change the label size, tick colors, etc …

Hope this helps!

1reaction
jondocommented, Dec 22, 2020

@lc5415, would you mind showing your emulating function?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Plotting UMAP results — umap 0.5 documentation
The umap. plot. points function will color the data with a categorical colormap according to the labels provided. Alternatively you may have extra...
Read more >
umap Documentation - Read the Docs
umap.plot.points function will color the data with a categorical colormap according to the labels provided. umap.plot.points(mapper, ...
Read more >
Add colorbar labels as text on scatter plot - Stack Overflow
1 Answer 1 ... Your code for the annotations is writing an annotation for each and every dot. This just ends in a...
Read more >
Customizing Colorbars | Python Data Science Handbook
Customizing Colorbars · Plot legends identify discrete labels of discrete points. · As we have seen several times throughout this section, the simplest...
Read more >
matplotlib.pyplot.colorbar — Matplotlib 3.6.2 documentation
Add a colorbar to a plot. ... The matplotlib.cm.ScalarMappable (i.e., AxesImage , ContourSet , etc.) described by this colorbar. This argument is mandatory...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found