MCPcopy Create free account
hub / github.com/scikit-learn/scikit-learn / make_plot

Function make_plot

examples/preprocessing/plot_all_scaling.py:209–248  ·  view source on GitHub ↗
(item_idx)

Source from the content-addressed store, hash-verified

207
208
209def make_plot(item_idx):
210 title, X = distributions[item_idx]
211 ax_zoom_out, ax_zoom_in, ax_colorbar = create_axes(title)
212 axarr = (ax_zoom_out, ax_zoom_in)
213 plot_distribution(
214 axarr[0],
215 X,
216 y,
217 hist_nbins=200,
218 x0_label=feature_mapping[features[0]],
219 x1_label=feature_mapping[features[1]],
220 title="Full data",
221 )
222
223 # zoom-in
224 zoom_in_percentile_range = (0, 99)
225 cutoffs_X0 = np.percentile(X[:, 0], zoom_in_percentile_range)
226 cutoffs_X1 = np.percentile(X[:, 1], zoom_in_percentile_range)
227
228 non_outliers_mask = np.all(X > [cutoffs_X0[0], cutoffs_X1[0]], axis=1) & np.all(
229 X < [cutoffs_X0[1], cutoffs_X1[1]], axis=1
230 )
231 plot_distribution(
232 axarr[1],
233 X[non_outliers_mask],
234 y[non_outliers_mask],
235 hist_nbins=50,
236 x0_label=feature_mapping[features[0]],
237 x1_label=feature_mapping[features[1]],
238 title="Zoom-in",
239 )
240
241 norm = mpl.colors.Normalize(y_full.min(), y_full.max())
242 mpl.colorbar.ColorbarBase(
243 ax_colorbar,
244 cmap=cmap,
245 norm=norm,
246 orientation="vertical",
247 label="Color mapping for values of y",
248 )
249
250
251# %%

Callers 1

Calls 4

create_axesFunction · 0.85
plot_distributionFunction · 0.85
minMethod · 0.80
maxMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…