GeezerVison is showing github.com — ImageWidget with 3+ subplots requires figure_shape · Issue #818 · fastplotlib/fastplotlib
ImageWidget with 3+ subplots requires figure_shape #818DescriptionThis 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 Activitykushalkolar commented on May 14, 2025 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: ***@***.***>
FlynnOConnell commented 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))kushalkolar commented on May 14, 2025 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.
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|