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

Function plot_distribution

examples/preprocessing/plot_all_scaling.py:166–198  ·  view source on GitHub ↗
(axes, X, y, hist_nbins=50, title="", x0_label="", x1_label="")

Source from the content-addressed store, hash-verified

164
165
166def plot_distribution(axes, X, y, hist_nbins=50, title="", x0_label="", x1_label=""):
167 ax, hist_X1, hist_X0 = axes
168
169 ax.set_title(title)
170 ax.set_xlabel(x0_label)
171 ax.set_ylabel(x1_label)
172
173 # The scatter plot
174 colors = cmap(y)
175 ax.scatter(X[:, 0], X[:, 1], alpha=0.5, marker="o", s=5, lw=0, c=colors)
176
177 # Removing the top and the right spine for aesthetics
178 # make nice axis layout
179 ax.spines["top"].set_visible(False)
180 ax.spines["right"].set_visible(False)
181 ax.get_xaxis().tick_bottom()
182 ax.get_yaxis().tick_left()
183 ax.spines["left"].set_position(("outward", 10))
184 ax.spines["bottom"].set_position(("outward", 10))
185
186 # Histogram for axis X1 (feature 5)
187 hist_X1.set_ylim(ax.get_ylim())
188 hist_X1.hist(
189 X[:, 1], bins=hist_nbins, orientation="horizontal", color="grey", ec="grey"
190 )
191 hist_X1.axis("off")
192
193 # Histogram for axis X0 (feature 0)
194 hist_X0.set_xlim(ax.get_xlim())
195 hist_X0.hist(
196 X[:, 0], bins=hist_nbins, orientation="vertical", color="grey", ec="grey"
197 )
198 hist_X0.axis("off")
199
200
201# %%

Callers 1

make_plotFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…