Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support figure kwargs in FlatVoxelViewer #139

Merged
merged 2 commits into from
Mar 13, 2025
Merged

Support figure kwargs in FlatVoxelViewer #139

merged 2 commits into from
Mar 13, 2025

Conversation

nvaytet
Copy link
Member

@nvaytet nvaytet commented Mar 12, 2025

This enables e.g. FlatVoxelViewer(dg, figsize=(10, 8), cmap='magma')

Fixes #138

@@ -149,8 +155,7 @@ def _flat_voxel_figure(
data: sc.DataArray,
horizontal_dim: str,
vertical_dim: str,
*,
rasterized: bool = True,
**kwargs: object,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why object instead of Any?

Copy link
Member Author

@nvaytet nvaytet Mar 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't know, it's object elsewhere in the file so I just used that. I can change all to Any if you like?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that is better. Not sure if it actually makes a difference in this case, but if we pass the kwargs to a function that doesn't take object arguments the type checker might be smart enough to yell at us.

@@ -182,7 +187,7 @@ def _flat_voxel_figure(
h_labels = [str(value) for value in h_coord.values]
v_labels = [str(value) for value in v_coord.values]

fig = flat.plot(rasterized=rasterized, cbar=True)
fig = flat.plot(**kwargs)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't we loose the cbar=True argument now?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes but I don't think it's needed? It works without it 🤷

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you're confident it makes no difference then that's good enough for me.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am also fine with the change

@@ -182,7 +187,7 @@ def _flat_voxel_figure(
h_labels = [str(value) for value in h_coord.values]
v_labels = [str(value) for value in v_coord.values]

fig = flat.plot(rasterized=rasterized, cbar=True)
fig = flat.plot(**kwargs)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am also fine with the change

@nvaytet nvaytet merged commit 74ff15b into main Mar 13, 2025
4 checks passed
@nvaytet nvaytet deleted the voxelviewer-kwargs branch March 13, 2025 09:26
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.

Add option to resize plot of FlatVoxelViewer (tool for DREAM)
3 participants