Skip to content

NickAkhmetov/Increase automatic scatterplot point size for improved visibility#2363

Merged
NickAkhmetov merged 4 commits intomainfrom
nickakhmetov/fix-2346
Dec 2, 2025
Merged

NickAkhmetov/Increase automatic scatterplot point size for improved visibility#2363
NickAkhmetov merged 4 commits intomainfrom
nickakhmetov/fix-2346

Conversation

@NickAkhmetov
Copy link
Copy Markdown
Collaborator

Fixes #2346

Background

It has been expressed that the default point size on the scatterplot is very small/difficult to work with.

This PR increases the baseline size of the automatically calculated points without affecting the other calculations.

Change List

  • Increases baseline point size from 0.05 percent of the diagonal axis to 1 percent of the diagonal axis.

Checklist

  • Have tested PR with one or more demo configurations
  • Documentation added, updated, or not applicable

Screenshots

Default codeluppi-2018 scatterplots (in expanded view) on production:
image

Default codeluppi-2018 scatterplots (in expanded view) with this change:
image

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Nov 26, 2025

Size Change: 0 B

Total Size: 7.35 MB

Filename Size Change
./packages/main/prod/dist/OrbitControls-********.js 0 B -229 kB (removed) 🏆
./packages/main/prod/dist/OrbitControls-uAuN_-6y.js 229 kB +229 kB (new file) 🆕
ℹ️ View Unchanged
Filename Size Change
./packages/main/prod/dist/blosc-********.js 612 kB 0 B
./packages/main/prod/dist/chunk-INHXZS53-********.js 558 B 0 B
./packages/main/prod/dist/deflate-oPeRim-T.js 0 B -208 B (removed) 🏆
./packages/main/prod/dist/higlass-********.js 3.57 MB 0 B
./packages/main/prod/dist/index-********.js 142 kB 0 B
./packages/main/prod/dist/index.min.js 1.38 kB 0 B
./packages/main/prod/dist/jpeg-********.js 15.6 kB 0 B
./packages/main/prod/dist/lerc-********.js 89.3 kB 0 B
./packages/main/prod/dist/lz4-********.js 43.9 kB 0 B
./packages/main/prod/dist/lzw-********.js 2.07 kB 0 B
./packages/main/prod/dist/packbits-********.js 541 B 0 B
./packages/main/prod/dist/pako.esm-********.js 37.1 kB 0 B
./packages/main/prod/dist/raw-********.js 133 B 0 B
./packages/main/prod/dist/ReactNeuroglancer-********.js 1.67 MB 0 B
./packages/main/prod/dist/troika-three-text.esm-********.js 179 kB 0 B
./packages/main/prod/dist/webimage-********.js 801 B 0 B
./packages/main/prod/dist/zstd-********.js 754 kB 0 B
./packages/main/prod/dist/deflate-********.js 208 B +208 B (new file) 🆕

compressed-size-action

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Nov 26, 2025

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 13.69% 9147 / 66800
🔵 Statements 13.69% 9147 / 66800
🔵 Functions 48.56% 525 / 1081
🔵 Branches 67.45% 1397 / 2071
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
packages/view-types/scatterplot-embedding/src/EmbeddingScatterplotSubscriber.js 0% 0% 0% 0% 1-678
packages/view-types/scatterplot-gating/src/GatingSubscriber.js 0% 0% 0% 0% 1-511
packages/view-types/scatterplot/src/shared-spatial-scatterplot/dynamic-opacity.js 96.72% 75% 100% 96.72% 100-101
Generated in workflow #4702 for commit 99a77ca by the Vitest Coverage Report Action

@keller-mark
Copy link
Copy Markdown
Member

This works well for smaller datasets but not larger datasets, such as http://localhost:3000/?dataset=salcher-2022&theme=light2 where the new larger point size makes it difficult to see the patterns (e.g., areas with a mix of yellow and blue cells when zoomed-out)

We may want the increased point size to also depend on the size of the dataset (maybe we can use the log of the number of cells?). (The getPointOpacity function uses numCells as a parameter, but it seems the current point size logic does not depend on numCells.)

Screenshot 2025-11-26 at 1 38 27 PM Screenshot 2025-11-26 at 1 40 47 PM

@NickAkhmetov
Copy link
Copy Markdown
Collaborator Author

NickAkhmetov commented Dec 1, 2025

I've adjusted the implementation so that point size scales appropriately between 1,000 cells or less -> 100,000 cells or more; i.e., at 1,000 cells or less, it uses an adjusted 0.005 value, at 500,000 cells or above it falls back to the previous base point size of 0.0005, and between those values it interpolates the log values to determine the appropriate size.

1,000,000 cell example:
image

4,839 cell example:
image

) {
// Calculate point size using reverse logarithmic scaling
// Smaller datasets get larger point sizes
const pointSize = getInitialPointSize(numCells);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const pointSize = getInitialPointSize(numCells);
// Allow to range from 0.05 to 0.0005
const pointSize = 5 / clamp(numCells, 100, 10000);

Looking more closely, I think we do not need to explicitly take the log10.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call! I've revised the helper function accordingly. I'd still prefer to keep it as a separate function for ease of testing (since the additional re-scaling done by getPointSizeDevicePixels made writing useful tests for this functionality trickier than anticipated)

@NickAkhmetov NickAkhmetov merged commit e2ce2e4 into main Dec 2, 2025
7 checks passed
@NickAkhmetov NickAkhmetov deleted the nickakhmetov/fix-2346 branch December 2, 2025 18:09
@github-actions github-actions bot mentioned this pull request Dec 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Increase default scatterplot point radius

2 participants