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

[Feature] Refactor API for plotting multiple 2D slices from the same dataset at different distances. #54

Open
IgorTatarnikov opened this issue Jul 24, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@IgorTatarnikov
Copy link
Member

Is your feature request related to a problem? Please describe.
The newly added Heatmap.plot_subplot() could have a better public facing API. Right now a separate scene is created for each subplot, this can cause a segmentation fault if the reference to each scene isn't kept between the plot_subplot() call and the call to plt.show().

Describe the solution you'd like
We could allow a scene to be initialised with more than one slicing location. The plot() function would then either provide a single plot if only one slicing location is provided or a plot with multiple subplots if multiple positions were passed during initialisation.

This would generate a single plot at position 8000:

scene = bgh.Heatmap(
    data_dict,
    position=8000,
    orientation="frontal",
    thickness=10,
    format="2D",
    cmap="Reds",
    vmin=0,
    vmax=1,
    label_regions=False,
).plot()

This would generate a plot with 6 subplots:

scene = bgh.Heatmap(
    data_dict,
    position=[7500, 8000, 8500, 9000, 9500, 10000],
    orientation="frontal",
    thickness=10,
    format="2D",
    cmap="Reds",
    vmin=0,
    vmax=1,
    label_regions=False,
).plot()

This is just one idea, the position argument already has a few meaning depending on the dimensionality of the visualisation and the specific type passed (tuple vs ndarray).

See discussion in #44.

@IgorTatarnikov IgorTatarnikov added the enhancement New feature or request label Jul 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant