Skip to content

matplotlib "normed" argument deprecated #3451

Closed
@sjshim

Description

@sjshim

Summary

When trying to use the nipype.algorithms.metrics.Distance with method='eucl_mean', get the following error
AttributeError: 'Rectangle' object has no property 'normed'

My two input volumes are z-stat map outputs from fitlins of the same individual (both are in same shape/dimensions).

It seems like the normed argument is deprecated in matplotlib.

Actual behavior

The following error

~/miniconda3/envs/fmri_analysis/lib/python3.9/site-packages/nipype/interfaces/base/core.py in run(self, cwd, ignore_exception, **inputs)
    426         try:
    427             runtime = self._pre_run_hook(runtime)
--> 428             runtime = self._run_interface(runtime)
    429             runtime = self._post_run_hook(runtime)
    430             outputs = self.aggregate_outputs(runtime)

~/miniconda3/envs/fmri_analysis/lib/python3.9/site-packages/nipype/algorithms/metrics.py in _run_interface(self, runtime)
    200 
    201         elif self.inputs.method == "eucl_mean":
--> 202             self._distance = self._eucl_mean(nii1, nii2)
    203 
    204         elif self.inputs.method == "eucl_wmean":

~/miniconda3/envs/fmri_analysis/lib/python3.9/site-packages/nipype/algorithms/metrics.py in _eucl_mean(self, nii1, nii2, weighted)
    151 
    152         plt.figure()
--> 153         plt.hist(min_dist_matrix, 50, normed=1, facecolor="green")
    154         plt.savefig(self._hist_filename)
    155         plt.clf()

~/miniconda3/envs/fmri_analysis/lib/python3.9/site-packages/matplotlib/pyplot.py in hist(x, bins, range, density, weights, cumulative, bottom, histtype, align, orientation, rwidth, log, color, label, stacked, data, **kwargs)
   2683         orientation='vertical', rwidth=None, log=False, color=None,
   2684         label=None, stacked=False, *, data=None, **kwargs):
-> 2685     return gca().hist(
   2686         x, bins=bins, range=range, density=density, weights=weights,
   2687         cumulative=cumulative, bottom=bottom, histtype=histtype,

~/miniconda3/envs/fmri_analysis/lib/python3.9/site-packages/matplotlib/__init__.py in inner(ax, data, *args, **kwargs)
   1445     def inner(ax, *args, data=None, **kwargs):
   1446         if data is None:
-> 1447             return func(ax, *map(sanitize_sequence, args), **kwargs)
   1448 
   1449         bound = new_sig.bind(ax, *args, **kwargs)

~/miniconda3/envs/fmri_analysis/lib/python3.9/site-packages/matplotlib/axes/_axes.py in hist(self, x, bins, range, density, weights, cumulative, bottom, histtype, align, orientation, rwidth, log, color, label, stacked, **kwargs)
   6813             if patch:
   6814                 p = patch[0]
-> 6815                 p.update(kwargs)
   6816                 if lbl is not None:
   6817                     p.set_label(lbl)

~/miniconda3/envs/fmri_analysis/lib/python3.9/site-packages/matplotlib/artist.py in update(self, props)
    994                     func = getattr(self, f"set_{k}", None)
    995                     if not callable(func):
--> 996                         raise AttributeError(f"{type(self).__name__!r} object "
    997                                              f"has no property {k!r}")
    998                     ret.append(func(v))

AttributeError: 'Rectangle' object has no property 'normed'

Expected behavior

Histogram output

Platform details:

{'commit_hash': '0289137',
 'commit_source': 'installation',
 'networkx_version': '2.5.1',
 'nibabel_version': '2.5.1',
 'nipype_version': '1.6.1',
 'numpy_version': '1.20.3',
 'pkg_path': '/home/users/sjshim/miniconda3/envs/fmri_analysis/lib/python3.9/site-packages/nipype',
 'scipy_version': '1.5.3',
 'sys_executable': '/home/users/sjshim/miniconda3/envs/fmri_analysis/bin/python',
 'sys_platform': 'linux',
 'sys_version': '3.9.7 (default, Sep 16 2021, 13:09:58) \n[GCC 7.5.0]',
 'traits_version': '6.2.0'}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions