Skip to content
This repository was archived by the owner on Feb 26, 2025. It is now read-only.
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

@Romane1234

Description

@Romane1234

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions