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.

NaNs with interactive plot

See original GitHub issue

I would like to visualize a single dataframe column / series of floats with no NaNs using interactive plotting, but the plot shows overlapping NaN values (screenshot). I am using the latest build off the master branch. And here is my code:

# cluster subset is the dataframe with no NaNs
umap.plot.output_notebook()
mapper = umap.UMAP().fit(cluster_subset)
p = umap.plot.interactive(mapper, hover_data=cluster_subset, point_size=3, theme='blue')

I am showing this in streamlit but the same thing happens in a jupyter notebook. Let me know if you have any idea what I’m doing wrong!

Thanks so much, Scott

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:1
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

9reactions
cchandlercommented, Apr 28, 2021

This morning I had a bunch of NaNs in my hover data despite no NaNs in the training frame. In my case it was because I had a mismatch between the indices I was providing to the ‘subset’ argument and the indices of the actual dataframe. Mine was due to selecting a subset of rows (df[df[‘some_column’] == ‘asdf’] eg idx values 3,4,9,11,12,13,15), doing a fit on those, and then accidentally providing linear, sequential numbers to subset (0,1,2,3,4). To fix I copied the DF and did a reset_index() and it fixed everything.

0reactions
lmcinnescommented, Apr 30, 2021

This will be because some points are ending up completely disconnected from everything. The key thing to check is the metric and possibly setting disconnection_distance to something on the case of using cosine, hellinger, jaccard, or other bounded metrics.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to deal with NaN values while plotting a boxplot using ...
To deal with NaN value while plotting a boxplot using Python, we can take the following steps −. Steps. Set the figure size...
Read more >
Plotting masked and NaN values - Matplotlib
Sometimes you need to plot data with missing values. One possibility is to simply remove undesired data points. The line plotted through the...
Read more >
Interactive Plots - The Examples Book
It allows the user to make interactive plots, which includes but is not limited to maps, ... #drops the columns that have NaN...
Read more >
ScottPlot, NaN, and Infinity
The OnNaN = Gap behavior treats NaN values as a line break, simulating the appearance of gaps in the data. var plt =...
Read more >
How to DO NOT fill area under NaN in plotly - Stack Overflow
How to use Plotly in offline mode? 0 · plot_ly() and shiny: change transparency of area fill in interactive environment · 5 ·...
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