← 返回首页
move viewport rect logic from subplot and docks to Figure by kushalkolar · Pull Request #724 · fastplotlib/fastplotlib · GitHub
Skip to content

Navigation Menu

Toggle navigation
Sign in
Appearance settings
Search or jump to...

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Include my email address so I can be contacted

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Resetting focus

move viewport rect logic from subplot and docks to Figure#724

Merged
clewis7 merged 18 commits into
mainfrom
subplot-docking
Feb 21, 2025
Merged

move viewport rect logic from subplot and docks to Figure#724
clewis7 merged 18 commits into
mainfrom
subplot-docking

Conversation

kushalkolar commented Feb 10, 2025
edited
Loading

Copy link
Copy Markdown
Member

First step towards #315 and #670

Things will change once pygfx refactors their viewport stuff, but I think it will be easier to adopt those changes after this PR since it makes Figure manage the bbox of all subplots. I think this is a good separation of responsibilities. After this PR arbitrary bboxes for subplots can be implemented.

  • move the subplot viewport rect and subplot docks viewport rect calculating logic to Figure.
    • clean up the logic for computing the rects, much easier to read now, @clewis7 will be happy 😆
  • Figure._render() and PlotArea._render() are now private, been meaning to do this for a long while.
  • flatten cameras, controllers arrays in Figure to prep things for a flexible rectangles mode.
    • make sure all tests pass with this, adjust the tests if necessary. Users have a lot of options here and the parsing code is kinda gnarly.
  • prepare Figure for flex rects mode by allowing Figure._subplots to be a 1D object array, figure methods have been adjusted accordingly.
  • Figure.spacing is a new property which allows setting the spacing between subplots, default is 2 pixels
  • add new screenshot test for gridplot with all subplot docks of a certain size, and an ImageWidget with all docks set to a certain size.
  • adjust imgui toolbar code accordingly

Introduces one minor breaking API change, Subplot.position no longer exists but it's unlikely anyone was using that.

Todo in future PR:

  • implement flexible resizable rectangle subplots
  • make a separte plot area specifically for subplot titles, remove top subplot "dock" so users have less control over it. It should be solely for subplot title text.

kushalkolar commented Feb 10, 2025
edited
Loading

Copy link
Copy Markdown
Member Author

biggest issue right now is when resizing, I think the canvas resizes a while before the new rect sizes are ready which causes wgpu draw errors this is Qt specific: pygfx/rendercanvas#56

kushalkolar marked this pull request as ready for review February 13, 2025 06:19
kushalkolar requested a review from clewis7 as a code owner February 13, 2025 06:19

kushalkolar commented Feb 13, 2025
edited
Loading

Copy link
Copy Markdown
Member Author

@clewis7 ready for review! Any ubuntu tests won't pass on github actions due to pygfx/pygfx#979 but the mac tests should all pass (except for pygfx-release, the ones using pygfx@main should pass)

also tests are all passing locally

Comment thread fastplotlib/layouts/_figure.py Show resolved Hide resolved
Comment thread fastplotlib/layouts/_figure.py Show resolved Hide resolved
Comment thread fastplotlib/layouts/_figure.py Outdated Show resolved Hide resolved
Comment thread fastplotlib/layouts/_figure.py Show resolved Hide resolved
Comment thread fastplotlib/layouts/_figure.py Show resolved Hide resolved
Comment thread fastplotlib/layouts/_figure.py Show resolved Hide resolved

Copy link
Copy Markdown
Member Author

all relevant tests passing now except the docs build but you fixed that in another PR so this is good for another look!

clewis7 left a comment

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality Hide comment

LGTM

clewis7 merged commit cf5b11b into main Feb 21, 2025
clewis7 deleted the subplot-docking branch February 21, 2025 18:54
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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.

2 participants

Footer

© 2026 GitHub, Inc.