Skip to content

better axes padding for tick labels, settable axis label#1049

Merged
kushalkolar merged 8 commits into
ndwidgetfrom
axes-improvements
May 9, 2026
Merged

better axes padding for tick labels, settable axis label#1049
kushalkolar merged 8 commits into
ndwidgetfrom
axes-improvements

Conversation

@kushalkolar

@kushalkolar kushalkolar commented May 9, 2026

Copy link
Copy Markdown
Member
  • Places axes positions based on the bbox of the tick labels text. Uses a private method from as described in Map Text boundaries to world bounding box if Text is in screen space pygfx/pygfx#967 (comment) , but I think that's fine at least for now.
  • axes labels, subplot.axes.x.label.set_text("..."), label is just a pygfx.Text object, placed at the midpoint of the current visible extent of the corresponding axis, works with perspective projections as well.
  • axes docs
  • new subpackage, fastplotlib.axes which has the axes module, cleaner, prevents circular imports which occur when placed in fastplotlib.tools.
  • needed to do some non-axes related cleanup, moved some stuff fastplotlib.utils to fastplotlib.graphics.utils, in order to get the API docs to auto generate.

LLM usage disclosure: I used claude for the _update_label() method, too lazy to work out the geometry but it seems right.

No performance impact (tested with spinning spiral example)

axis-labels-2026-05-09_03.42.50.mp4

@cwindolf

@kushalkolar kushalkolar requested a review from clewis7 as a code owner May 9, 2026 07:50
@kushalkolar kushalkolar merged commit 71cf24f into ndwidget May 9, 2026
@kushalkolar kushalkolar deleted the axes-improvements branch May 9, 2026 12:07
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