Skip to content

fix: misc fixes with histogram behaviors and styles for both backends#264

Merged
tlambert03 merged 14 commits intopyapp-kit:mainfrom
tlambert03:fix-histogram
Mar 28, 2026
Merged

fix: misc fixes with histogram behaviors and styles for both backends#264
tlambert03 merged 14 commits intopyapp-kit:mainfrom
tlambert03:fix-histogram

Conversation

@tlambert03
Copy link
Copy Markdown
Member

Vispy Histogram

image
  • Fix: mouse wheel crashIndexError in PanZoom1DCamera.pan() (when click-dragging on vispy histogram... cc @fdrgsp )
  • Reduce axis padding — smaller tick font size (8→6), tick label margin (12→6), grid margin (10→0), axis widget sizes, and left padding to reclaim wasted space
  • Fix: log mode y-axis scaling — camera y-range now log-transforms to match the log-transformed mesh data, so bars fill the plot area
  • Log-scale y-axis labels — custom LogTicker that shows original count values (0, 1, 10, 100, 1000) at log-spaced positions instead of hiding labels entirely
  • Y-axis autoscale on new dataset_data now passes the new max count to _resize, so the y-range updates with each data change
  • Mouse wheel zoom pins minimum — scrolling scales only the max end of the x-axis, keeping 0 (or the current min) fixed. This makes it much easier to scroll the mouse wheel to adjust the range of the histogram to what you usually want to look at (changing the max value, not the min value)

PyGFX Histogram

image
  • Reduce left paddingmargin_left reduced from 50 to 34
  • Thinner/smaller axis labels — font size 12→10, tick size 8→4, weight offset set to -300 for lighter text, line width set to 1
  • Fix: log mode y-axis scaling — same as vispy: log-transform applied to count-axis range in _resize
  • Fix: log mode double-transform_resize only applies log transform to raw count values, not to already-transformed scale_y fallback
  • Y-axis labels on initial open — y-ruler positions and ticks recomputed in _animate on canvas resize, so labels appear immediately
  • Y-axis labels show original counts in log mode — converts log-transformed values back to original counts for display
  • Y-axis labels always integertick_format=".0f" on y-axis ruler
  • Remove opaque backgrounds from axis scenes — x/y axis scenes no longer occlude each other's labels
  • Render order fix — y-axis renders before x-axis so x labels aren't hidden
  • Mouse wheel zoom pins minimum — same as vispy, keeps left edge fixed
  • Extracted _update_y_ruler helper — deduplicates y-axis ruler logic between _resize and _animate
  • Y-axis autoscale on new data — same as vispy

Other

  • ROI button hidden by defaultshow_roi_button default changed to False
  • Collapsible button row spacing — increased from 0 to 2

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 28, 2026

Codecov Report

❌ Patch coverage is 50.00000% with 73 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.84%. Comparing base (799d0f4) to head (b174478).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
src/ndv/views/_vispy/_plot_widget.py 32.94% 57 Missing ⚠️
src/ndv/views/_pygfx/_histogram.py 63.41% 15 Missing ⚠️
src/ndv/views/_vispy/_histogram.py 92.85% 1 Missing ⚠️

❌ Your patch status has failed because the patch coverage (50.00%) is below the target coverage (85.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #264      +/-   ##
==========================================
- Coverage   86.79%   85.84%   -0.96%     
==========================================
  Files          50       50              
  Lines        5725     5848     +123     
==========================================
+ Hits         4969     5020      +51     
- Misses        756      828      +72     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@tlambert03 tlambert03 enabled auto-merge (squash) March 28, 2026 18:37
@tlambert03 tlambert03 merged commit 8d46c1b into pyapp-kit:main Mar 28, 2026
61 checks passed
@tlambert03 tlambert03 deleted the fix-histogram branch March 28, 2026 18:38
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.

1 participant