Skip to content
This repository was archived by the owner on Feb 26, 2025. It is now read-only.

[Bug report] show_plot=False outputs blank image for view.neuron #99

Open
Romane1234 opened this issue Nov 17, 2024 · 0 comments
Open
Labels
bug Something isn't working

Comments

@Romane1234
Copy link

Describe the bug

When using view.neuron(neu, output_path=output_path, output_name= output_name, neurite_type=ntype_view,xlim=xlim,ylim=ylim,show_plot=False), the image saved is blank.

Optional link from https://TMD.readthedocs.io which documents the behavior that is expected

No response

To Reproduce

filename is a .asc file from a pyramidal cell

neu = tmd.io.load_neuron_from_morphio(filename)
output_path = "./"
view.neuron(neu, output_path=output_path, output_name= "neuron", title = "Neuron", neurite_type=['apical_dendrite','basal_dendrite'],show_plot=False)

Error

.

Additional context

The view.neuron function is calling several times common.plot_style. Therefore, with show_plot=False, the image is erased at each step.

Proposed solution

In https://github.com/BlueBrain/TMD/blob/master/tmd/view/view.py#L356-#L358, replace by

show_plot = all_kwargs.pop("show_plot")

fig, ax = cm.plot_style(fig=fig, ax=ax, **all_kwargs)

if show_plot == False:
    fig.close()
    return (None,None)

return fig,ax

The idea is simply to pass show_plot at the end of the neuron plot

tmd Version in Use

bb32da1

Python Version

3.10.14

Operating system

MacOS

@Romane1234 Romane1234 added the bug Something isn't working label Nov 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant