From f775ccda5fc2effb15afa5eb4866a581de15ad34 Mon Sep 17 00:00:00 2001 From: Larry Gray Date: Wed, 19 Feb 2025 13:56:40 -0700 Subject: [PATCH] regressor: Remove deprecated use_line_collection from stem plots The use_line_collection parameter was removed in Matplotlib 3.6.0 as LineCollection became the only implementation for stem plots. This fixes the TypeError when using newer versions of Matplotlib. This commit requires updating the minimum Matplotlib version to 3.6.0 before it can be merged. Fixes #[1314] --- yellowbrick/regressor/influence.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/yellowbrick/regressor/influence.py b/yellowbrick/regressor/influence.py index 7ba3a8af0..220b044ff 100644 --- a/yellowbrick/regressor/influence.py +++ b/yellowbrick/regressor/influence.py @@ -155,7 +155,7 @@ def fit(self, X, y): # Compute Cook's distance residuals_studentized = residuals / np.sqrt(mse) / np.sqrt(1 - leverage) - self.distance_ = residuals_studentized ** 2 / X.shape[1] + self.distance_ = residuals_studentized**2 / X.shape[1] self.distance_ *= leverage / (1 - leverage) # Compute the p-values of Cook's Distance @@ -180,8 +180,9 @@ def draw(self): """ # Draw a stem plot with the influence for each instance _, _, baseline = self.ax.stem( - self.distance_, linefmt=self.linefmt, markerfmt=self.markerfmt, - use_line_collection=True + self.distance_, + linefmt=self.linefmt, + markerfmt=self.markerfmt, ) # No padding on either side of the instance index