Skip to content

Commit 5ebaf84

Browse files
authored
Merge pull request #820 from effigies/fix/mpl-deprecations
FIX: Replace deprecated Matplotlib functionality
2 parents c86c328 + 9b1249a commit 5ebaf84

File tree

4 files changed

+25
-24
lines changed

4 files changed

+25
-24
lines changed

niworkflows/interfaces/reportlets/registration.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@
3232
)
3333
from nipype.interfaces.mixins import reporting
3434
from nipype.interfaces import freesurfer as fs
35-
from nipype.interfaces import fsl, ants
35+
from nipype.interfaces import fsl
36+
from nipype.interfaces.ants import registration, resampling
3637

3738
from ... import NIWORKFLOWS_LOG
3839
from . import base as nrb
@@ -82,13 +83,13 @@ def _post_run_hook(self, runtime):
8283

8384

8485
class _ANTSRegistrationInputSpecRPT(
85-
nrb._SVGReportCapableInputSpec, ants.registration.RegistrationInputSpec
86+
nrb._SVGReportCapableInputSpec, registration.RegistrationInputSpec
8687
):
8788
pass
8889

8990

9091
class _ANTSRegistrationOutputSpecRPT(
91-
reporting.ReportCapableOutputSpec, ants.registration.RegistrationOutputSpec
92+
reporting.ReportCapableOutputSpec, registration.RegistrationOutputSpec
9293
):
9394
pass
9495

@@ -110,13 +111,13 @@ def _post_run_hook(self, runtime):
110111

111112

112113
class _ANTSApplyTransformsInputSpecRPT(
113-
nrb._SVGReportCapableInputSpec, ants.resampling.ApplyTransformsInputSpec
114+
nrb._SVGReportCapableInputSpec, resampling.ApplyTransformsInputSpec
114115
):
115116
pass
116117

117118

118119
class _ANTSApplyTransformsOutputSpecRPT(
119-
reporting.ReportCapableOutputSpec, ants.resampling.ApplyTransformsOutputSpec
120+
reporting.ReportCapableOutputSpec, resampling.ApplyTransformsOutputSpec
120121
):
121122
pass
122123

niworkflows/interfaces/tests/test_bids.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ def test_DerivativesDataSink_build_path(
300300
**entities,
301301
)
302302

303-
if type(expectation) == type(Exception):
303+
if isinstance(expectation, type):
304304
with pytest.raises(expectation):
305305
dds.run()
306306
return

niworkflows/viz/plots.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -838,9 +838,9 @@ def compcor_variance_plot(
838838

839839
ax[m].set_yticks([])
840840
ax[m].set_yticklabels([])
841-
for tick in ax[m].xaxis.get_major_ticks():
842-
tick.label.set_fontsize("x-small")
843-
tick.label.set_rotation("vertical")
841+
for label in ax[m].xaxis.get_majorticklabels():
842+
label.set_fontsize("x-small")
843+
label.set_rotation("vertical")
844844
for side in ["top", "right", "left"]:
845845
ax[m].spines[side].set_color("none")
846846
ax[m].spines[side].set_visible(False)
@@ -934,10 +934,10 @@ def confounds_correlation_plot(
934934
sns.heatmap(corr, linewidths=0.5, cmap="coolwarm", center=0, square=True, ax=ax0)
935935
ax0.tick_params(axis="both", which="both", width=0)
936936

937-
for tick in ax0.xaxis.get_major_ticks():
938-
tick.label.set_fontsize("small")
939-
for tick in ax0.yaxis.get_major_ticks():
940-
tick.label.set_fontsize("small")
937+
for label in ax0.xaxis.get_majorticklabels():
938+
label.set_fontsize("small")
939+
for label in ax0.yaxis.get_majorticklabels():
940+
label.set_fontsize("small")
941941
sns.barplot(
942942
data=gscorr,
943943
x="index",
@@ -953,11 +953,11 @@ def confounds_correlation_plot(
953953
ax1.tick_params(axis="x", which="both", width=0)
954954
ax1.tick_params(axis="y", which="both", width=5, length=5)
955955

956-
for tick in ax1.xaxis.get_major_ticks():
957-
tick.label.set_fontsize("small")
958-
tick.label.set_rotation("vertical")
959-
for tick in ax1.yaxis.get_major_ticks():
960-
tick.label.set_fontsize("small")
956+
for label in ax1.xaxis.get_majorticklabels():
957+
label.set_fontsize("small")
958+
label.set_rotation("vertical")
959+
for label in ax1.yaxis.get_majorticklabels():
960+
label.set_fontsize("small")
961961
for side in ["top", "right", "left"]:
962962
ax1.spines[side].set_color("none")
963963
ax1.spines[side].set_visible(False)

niworkflows/viz/utils.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -698,9 +698,9 @@ def plot_melodic_components(
698698
ax2.autoscale_view("tight")
699699
ax2.tick_params(axis="both", which="major", pad=0)
700700
sns.despine(left=True, bottom=True)
701-
for tick in ax2.xaxis.get_major_ticks():
702-
tick.label.set_fontsize(6)
703-
tick.label.set_color(color_time)
701+
for label in ax2.xaxis.get_majorticklabels():
702+
label.set_fontsize(6)
703+
label.set_color(color_time)
704704

705705
ax3.plot(
706706
f[0:],
@@ -712,9 +712,9 @@ def plot_melodic_components(
712712
ax3.axes.get_yaxis().set_visible(False)
713713
ax3.autoscale_view("tight")
714714
ax3.tick_params(axis="both", which="major", pad=0)
715-
for tick in ax3.xaxis.get_major_ticks():
716-
tick.label.set_fontsize(6)
717-
tick.label.set_color(color_power)
715+
for label in ax3.xaxis.get_majorticklabels():
716+
label.set_fontsize(6)
717+
label.set_color(color_power)
718718
sns.despine(left=True, bottom=True)
719719

720720
plt.subplots_adjust(hspace=0.5)

0 commit comments

Comments
 (0)