10000 matplotlib new figure creation modified · thismlguy/scikit-learn@f4d8a64 · GitHub
[go: up one dir, main page]

Skip to content

Commit f4d8a64

Browse files
aarshayjthismlguy
authored andcommitted
matplotlib new figure creation modified
1 parent d676be3 commit f4d8a64

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

sklearn/plot/_gridsearch_results.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ def _plot_1D_results(cv_results, params, ax, xlabel, ylabel, title,
66
fmt, xtickrotation):
77
import matplotlib.pyplot as plt
88
if ax is None:
9-
ax = plt.gca()
9+
fig = plt.figure()
10+
ax = fig.add_subplot(111)
1011

1112
param = params[0]
1213
param_range = sorted(cv_results['param_%s' % param])
@@ -40,6 +41,7 @@ def _plot_1D_results(cv_results, params, ax, xlabel, ylabel, title,
4041
ylabel = "Score" if ylabel is None else ylabel
4142
ax.set_ylabel(ylabel)
4243
ax.set_title(title)
44+
plt.draw()
4345
return img
4446

4547

sklearn/plot/_heatmap.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ def plot_heatmap(values, xlabel="", ylabel="", xticklabels=None,
5252

5353
import matplotlib.pyplot as plt
5454
if ax is None:
55-
ax = plt.gca()
55+
fig = plt.figure()
56+
ax = fig.add_subplot(111)
5657
img = ax.pcolormesh(values, cmap=cmap, vmin=vmin, vmax=vmax, norm=norm)
5758

5859
# this will allow us to access the pixel values:
@@ -98,4 +99,6 @@ def plot_heatmap(values, xlabel="", ylabel="", xticklabels=None,
9899
if title is not None:
99100
ax.set_title(title)
100101

102+
plt.draw()
103+
101104
return img

0 commit comments

Comments
 (0)
0