// Set the X and Y limits
// The silhouette coefficient can range from -1, 1
self.ax.set_xlim([-1, 1])
// The (n_clusters_+1)*10 is for inserting blank space between
// silhouette plots of individual clusters, to demarcate them clearly.
self.ax.set_ylim([0, self.n_samples_ + (self.n_clusters_ + 1) * 10])
After Change
// l_xlim and u_xlim are lower and upper limits of the x-axis,
// set according to our calculated maximum and minimum silhouette score along with necessary padding
l_xlim = max(-1, min(-0.1, round(min(self.silhouette_samples_) - 0.1, 1)))
u_xlim = min(1, round(max(self.silhouette_samples_) + 0.1, 1))
self.ax.set_xlim([l_xlim, u_xlim])
// The (n_clusters_+1)*10 is for inserting blank space between