GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — ImageWidget with 3+ subplots requires figure_shape · Issue #818 · fastplotlib/fastplotlib

ImageWidget with 3+ subplots requires figure_shape #818

New issue
Copy link
New issue
Copy link
Closed
#828
Closed
ImageWidget with 3+ subplots requires figure_shape#818
#828
Copy link

Description

@FlynnOConnell
FlynnOConnell
opened on May 14, 2025
Issue body actions

This does not work:

iw = fpl.ImageWidget(data=[data_raw, data_reg, mean_sub], names=["Raw", "Registered", "Reg, Mean-Sub"])
iw.show()

...
    158     if subplot_names.size != n_subplots:
--> 159         raise ValueError(
    160             f"must provide same number of subplot `names` as specified by shape, extents, or rects: {n_subplots}"

ValueError: must provide same number of subplot `names` as specified by shape, extents, or rects: 4

This is fixed by specifying figure shape:

iw = fpl.ImageWidget(data=[data_raw, data_reg, mean_sub], names=["Raw", "Registered", "Reg, Mean-Sub"], figure_shape=(1, 3))
iw.show()

This is confusing and took me a while to figure out

Activity

  1. kushalkolar commented on May 14, 2025

    @kushalkolar
    kushalkolar
    on May 14, 2025 via email
    Member
    More actions
    I ran into this for a minute yesterday too 😂. Any ideas for a generalizable solution?
    …
    On Wed, May 14, 2025, 11:27 Flynn ***@***.***> wrote: *FlynnOConnell* created an issue (fastplotlib/fastplotlib#818) <#818> This does not work: iw = fpl.ImageWidget(data=[data_raw, data_reg, mean_sub], names=["Raw", "Registered", "Reg, Mean-Sub"])iw.show() ... 158 if subplot_names.size != n_subplots:--> 159 raise ValueError( 160 f"must provide same number of subplot `names` as specified by shape, extents, or rects: {n_subplots}" ValueError: must provide same number of subplot `names` as specified by shape, extents, or rects: 4 This is fixed by specifying figure shape: iw = fpl.ImageWidget(data=[data_raw, data_reg, mean_sub], names=["Raw", "Registered", "Reg, Mean-Sub"], figure_shape=(1, 3))iw.show() This is confusing and took me a while to figure out — Reply to this email directly, view it on GitHub <#818>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/ACHXXRCSTUJGADNTBBMRYOL26NOHDAVCNFSM6AAAAAB5DWSNK2VHI2DSMVQWIX3LMV43ASLTON2WKOZTGA3DGNJRGY4TQNA> . You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
  2. FlynnOConnell commented on May 14, 2025

    @FlynnOConnell
    FlynnOConnell
    on May 14, 2025
    CollaboratorAuthor
    More actions

    I naively expect a single row when I don't specify a figure shape. A default that makes sense to me would be up to 4 or 5 plots in a row, any more than that, optimize to be a square. Something like this?

    n = n_subplots
    if n <= 5:
        rows, cols = 1, n
    else:
        cols = int(ceil(sqrt(n)))
        rows = int(ceil(n / cols))
  3. kushalkolar commented on May 14, 2025

    @kushalkolar
    kushalkolar
    on May 14, 2025
    Member
    More actions

    That gets very messy fast. I think a better way here would be to verify the number of data arrays and names matches, and to pad names with empties if there are blank subplots for the given shape. A user can still specify an arbitrary shape which has more subplots than they need, ex: (2, 3) to view 5 arrays.

  4. clewis7
    closed this as completedin #828on May 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.