def plot_rgb(image, name, label=None, label_color='w', label_size='large'):
"""
This will plot the r,g,b channels of an *image* of shape (N,M,3) or
(N,M,4). *name* is the prefix of the file name, which will be supplemented
with "_rgb.png." *label*, *label_color* and *label_size* may also be
specified.
"""
import pylab
Nvec = image.shape[0]
image[np.isnan(image)] = 0.0
if image.shape[2] >= 4:
image = image[:,:,:3]
pylab.clf()
pylab.gcf().set_dpi(100)
pylab.gcf().set_size_inches((Nvec/100.0, Nvec/100.0))
pylab.gcf().subplots_adjust(left=0.0, right=1.0, bottom=0.0, top=1.0, wspace=0.0, hspace=0.0)
pylab.imshow(image, interpolation='nearest')
if label is not None:
pylab.text(20, 20, label, color = label_color, size=label_size)
pylab.savefig("%s_rgb.png" % name)
pylab.clf()
python类gcf()的实例源码
def on_epoch_end(self, epoch, logs={}):
self.model.save_weights(os.path.join(self.output_dir, 'weights%02d.h5' % epoch))
self.show_edit_distance(256)
word_batch = next(self.text_img_gen)[0]
res = decode_batch(self.test_func, word_batch['the_input'][0:self.num_display_words])
for i in range(self.num_display_words):
pylab.subplot(self.num_display_words, 1, i + 1)
if K.image_dim_ordering() == 'th':
the_input = word_batch['the_input'][i, 0, :, :]
else:
the_input = word_batch['the_input'][i, :, :, 0]
pylab.imshow(the_input, cmap='Greys_r')
pylab.xlabel('Truth = \'%s\' Decoded = \'%s\'' % (word_batch['source_str'][i], res[i]))
fig = pylab.gcf()
fig.set_size_inches(10, 12)
pylab.savefig(os.path.join(self.output_dir, 'e%02d.png' % epoch))
pylab.close()
# Input Parameters
def on_epoch_end(self, epoch, logs={}):
self.model.save_weights(os.path.join(self.output_dir, 'weights%02d.h5' % (epoch)))
self.show_edit_distance(256)
word_batch = next(self.text_img_gen)[0]
res = decode_batch(self.test_func, word_batch['the_input'][0:self.num_display_words])
if word_batch['the_input'][0].shape[0] < 256:
cols = 2
else:
cols = 1
for i in range(self.num_display_words):
pylab.subplot(self.num_display_words // cols, cols, i + 1)
if K.image_dim_ordering() == 'th':
the_input = word_batch['the_input'][i, 0, :, :]
else:
the_input = word_batch['the_input'][i, :, :, 0]
pylab.imshow(the_input.T, cmap='Greys_r')
pylab.xlabel('Truth = \'%s\'\nDecoded = \'%s\'' % (word_batch['source_str'][i], res[i]))
fig = pylab.gcf()
fig.set_size_inches(10, 13)
pylab.savefig(os.path.join(self.output_dir, 'e%02d.png' % (epoch)))
pylab.close()
image_ocr_gpu.py 文件源码
项目:keras-mxnet-benchmarks
作者: sandeep-krishnamurthy
项目源码
文件源码
阅读 27
收藏 0
点赞 0
评论 0
def on_epoch_end(self, epoch, logs={}):
self.model.save_weights(os.path.join(self.output_dir, 'weights%02d.h5' % (epoch)))
self.show_edit_distance(256)
word_batch = next(self.text_img_gen)[0]
res = decode_batch(self.test_func, word_batch['the_input'][0:self.num_display_words])
if word_batch['the_input'][0].shape[0] < 256:
cols = 2
else:
cols = 1
for i in range(self.num_display_words):
pylab.subplot(self.num_display_words // cols, cols, i + 1)
if K.image_dim_ordering() == 'th':
the_input = word_batch['the_input'][i, 0, :, :]
else:
the_input = word_batch['the_input'][i, :, :, 0]
pylab.imshow(the_input.T, cmap='Greys_r')
pylab.xlabel('Truth = \'%s\'\nDecoded = \'%s\'' % (word_batch['source_str'][i], res[i]))
fig = pylab.gcf()
fig.set_size_inches(10, 13)
pylab.savefig(os.path.join(self.output_dir, 'e%02d.png' % (epoch)))
pylab.close()
PlayCatchGame.py 文件源码
项目:CatchGame-QLearningExample-TensorFlow
作者: solaris33
项目源码
文件源码
阅读 20
收藏 0
点赞 0
评论 0
def drawState(fruitRow, fruitColumn, basket):
global gridSize
# column is the x axis
fruitX = fruitColumn
# Invert matrix style points to coordinates
fruitY = (gridSize - fruitRow + 1)
statusTitle = "Wins: " + str(winCount) + " Losses: " + str(loseCount) + " TotalGame: " + str(numberOfGames)
axis.set_title(statusTitle, fontsize=30)
for p in [
patches.Rectangle(
((ground - 1), (ground)), 11, 10,
facecolor="#000000" # Black
),
patches.Rectangle(
(basket - 1, ground), 2, 0.5,
facecolor="#FF0000" # No background
),
patches.Rectangle(
(fruitX - 0.5, fruitY - 0.5), 1, 1,
facecolor="#FF0000" # red
),
]:
axis.add_patch(p)
display.clear_output(wait=True)
display.display(pl.gcf())
def tile_images(image_batch, image_width=28, image_height=28, image_channel=1, dir=None, filename="images"):
if dir is None:
raise Exception()
try:
os.mkdir(dir)
except:
pass
fig = pylab.gcf()
fig.set_size_inches(16.0, 16.0)
pylab.clf()
pylab.gray()
for m in range(100):
pylab.subplot(10, 10, m + 1)
pylab.imshow(image_batch[m].reshape((image_width, image_height)), interpolation="none")
pylab.axis("off")
pylab.savefig("{}/{}.png".format(dir, filename))
def scatter_labeled_z(z_batch, label_batch, filename="labeled_z"):
fig = pylab.gcf()
fig.set_size_inches(20.0, 16.0)
pylab.clf()
colors = ["#2103c8", "#0e960e", "#e40402","#05aaa8","#ac02ab","#aba808","#151515","#94a169", "#bec9cd", "#6a6551"]
for n in range(z_batch.shape[0]):
result = pylab.scatter(z_batch[n, 0], z_batch[n, 1], c=colors[label_batch[n]], s=40, marker="o", edgecolors='none')
classes = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]
recs = []
for i in range(0, len(colors)):
recs.append(mpatches.Rectangle((0, 0), 1, 1, fc=colors[i]))
ax = pylab.subplot(111)
box = ax.get_position()
ax.set_position([box.x0, box.y0, box.width * 0.8, box.height])
ax.legend(recs, classes, loc="center left", bbox_to_anchor=(1.1, 0.5))
pylab.xticks(pylab.arange(-4, 5))
pylab.yticks(pylab.arange(-4, 5))
pylab.xlabel("z1")
pylab.ylabel("z2")
pylab.savefig(filename)
def despine(fig=None, ax=None, top=True, right=True,
left=False, bottom=False):
"""Remove the top and right spines from plot(s).
fig : matplotlib figure
figure to despine all axes of, default uses current figure
ax : matplotlib axes
specific axes object to despine
top, right, left, bottom : boolean
if True, remove that spine
"""
if fig is None and ax is None:
axes = plt.gcf().axes
elif fig is not None:
axes = fig.axes
elif ax is not None:
axes = [ax]
for ax_i in axes:
for side in ["top", "right", "left", "bottom"]:
ax_i.spines[side].set_visible(not locals()[side])
def visualize_reconstruction(xp, model, x, visualization_dir, epoch, gpu=False):
x_variable = chainer.Variable(xp.asarray(x))
_x = model.decode(model.encode(x_variable), test=True)
_x.to_cpu()
_x = _x.data
fig = pylab.gcf()
fig.set_size_inches(8.0, 8.0)
pylab.clf()
pylab.gray()
for m in range(50):
i = m / 10
j = m % 10
pylab.subplot(10, 10, 20 * i + j + 1, xticks=[], yticks=[])
pylab.imshow(x[m].reshape((28, 28)), interpolation="none")
pylab.subplot(10, 10, 20 * i + j + 10 + 1, xticks=[], yticks=[])
pylab.imshow(_x[m].reshape((28, 28)), interpolation="none")
# pylab.imshow(np.clip((_x_batch.data[m] + 1.0) / 2.0, 0.0, 1.0).reshape(
# (config.img_channel, config.img_width, config.img_width)), interpolation="none")
pylab.axis("off")
pylab.savefig("{}/reconstruction_{}.png".format(visualization_dir, epoch))
# pylab.show()
def drawState(fruitRow, fruitColumn, basket):
global gridSize
# column is the x axis
fruitX = fruitColumn
# Invert matrix style points to coordinates
fruitY = (gridSize - fruitRow + 1)
statusTitle = "Wins: " + str(winCount) + " Losses: " + str(loseCount) + " TotalGame: " + str(numberOfGames)
axis.set_title(statusTitle, fontsize=30)
for p in [
patches.Rectangle(
((ground - 1), (ground)), 11, 10,
facecolor="#000000" # Black
),
patches.Rectangle(
(basket - 1, ground), 2, 0.5,
facecolor="#FF0000" # No background
),
patches.Rectangle(
(fruitX - 0.5, fruitY - 0.5), 1, 1,
facecolor="#FF0000" # red
),
]:
axis.add_patch(p)
display.clear_output(wait=True)
display.display(pl.gcf())
def on_epoch_end(self, epoch, logs={}):
self.model.save_weights(os.path.join(self.output_dir, 'weights%02d.h5' % (epoch)))
self.show_edit_distance(256)
word_batch = next(self.text_img_gen)[0]
res = decode_batch(self.test_func, word_batch['the_input'][0:self.num_display_words])
if word_batch['the_input'][0].shape[0] < 256:
cols = 2
else:
cols = 1
for i in range(self.num_display_words):
pylab.subplot(self.num_display_words // cols, cols, i + 1)
if K.image_dim_ordering() == 'th':
the_input = word_batch['the_input'][i, 0, :, :]
else:
the_input = word_batch['the_input'][i, :, :, 0]
pylab.imshow(the_input.T, cmap='Greys_r')
pylab.xlabel('Truth = \'%s\'\nDecoded = \'%s\'' % (word_batch['source_str'][i], res[i]))
fig = pylab.gcf()
fig.set_size_inches(10, 13)
pylab.savefig(os.path.join(self.output_dir, 'e%02d.png' % (epoch)))
pylab.close()
def show_chains(rbm, state, dataset, num_particles=20, num_samples=20, show_every=10, display=True,
figname='Gibbs chains', figtitle='Gibbs chains'):
samples = gnp.zeros((num_particles, num_samples, state.v.shape[1]))
state = state[:num_particles, :, :]
for i in range(num_samples):
samples[:, i, :] = rbm.vis_expectations(state.h)
for j in range(show_every):
state = rbm.step(state)
npix = dataset.num_rows * dataset.num_cols
rows = [vm.hjoin([samples[i, j, :npix].reshape((dataset.num_rows, dataset.num_cols)).as_numpy_array()
for j in range(num_samples)],
normalize=False)
for i in range(num_particles)]
grid = vm.vjoin(rows, normalize=False)
if display:
pylab.figure(figname)
pylab.matshow(grid, cmap='gray', fignum=False)
pylab.title(figtitle)
pylab.gcf().canvas.draw()
return grid
def plot_kde(data, dir=None, filename="kde", color="Greens"):
if dir is None:
raise Exception()
try:
os.mkdir(dir)
except:
pass
fig = pylab.gcf()
fig.set_size_inches(16.0, 16.0)
pylab.clf()
bg_color = sns.color_palette(color, n_colors=256)[0]
ax = sns.kdeplot(data[:, 0], data[:,1], shade=True, cmap=color, n_levels=30, clip=[[-4, 4]]*2)
ax.set_axis_bgcolor(bg_color)
kde = ax.get_figure()
pylab.xlim(-4, 4)
pylab.ylim(-4, 4)
kde.savefig("{}/{}.png".format(dir, filename))
def plot_kde(data, dir=None, filename="kde", color="Greens"):
if dir is None:
raise Exception()
try:
os.mkdir(dir)
except:
pass
fig = pylab.gcf()
fig.set_size_inches(16.0, 16.0)
pylab.clf()
bg_color = sns.color_palette(color, n_colors=256)[0]
ax = sns.kdeplot(data[:, 0], data[:,1], shade=True, cmap=color, n_levels=30, clip=[[-4, 4]]*2)
ax.set_axis_bgcolor(bg_color)
kde = ax.get_figure()
pylab.xlim(-4, 4)
pylab.ylim(-4, 4)
kde.savefig("{}/{}".format(dir, filename))
def tile_binary_images(x, dir=None, filename="x", row=10, col=10):
if dir is None:
raise Exception()
try:
os.mkdir(dir)
except:
pass
fig = pylab.gcf()
fig.set_size_inches(col * 2, row * 2)
pylab.clf()
pylab.gray()
for m in range(row * col):
pylab.subplot(row, col, m + 1)
pylab.imshow(np.clip(x[m], 0, 1), interpolation="none")
pylab.axis("off")
pylab.savefig("{}/{}.png".format(dir, filename))
def plot_kde(data, dir=None, filename="kde", color="Greens"):
if dir is None:
raise Exception()
try:
os.mkdir(dir)
except:
pass
fig = pylab.gcf()
fig.set_size_inches(16.0, 16.0)
pylab.clf()
bg_color = sns.color_palette(color, n_colors=256)[0]
ax = sns.kdeplot(data[:, 0], data[:,1], shade=True, cmap=color, n_levels=30, clip=[[-4, 4]]*2)
ax.set_axis_bgcolor(bg_color)
kde = ax.get_figure()
pylab.xlim(-4, 4)
pylab.ylim(-4, 4)
kde.savefig("{}/{}.png".format(dir, filename))
def plot_kde(data, dir=None, filename="kde", color="Greens"):
if dir is None:
raise Exception()
try:
os.mkdir(dir)
except:
pass
fig = pylab.gcf()
fig.set_size_inches(16.0, 16.0)
pylab.clf()
bg_color = sns.color_palette(color, n_colors=256)[0]
ax = sns.kdeplot(data[:, 0], data[:,1], shade=True, cmap=color, n_levels=30, clip=[[-4, 4]]*2)
ax.set_axis_bgcolor(bg_color)
kde = ax.get_figure()
pylab.xlim(-4, 4)
pylab.ylim(-4, 4)
kde.savefig("{}/{}".format(dir, filename))
def tile_binary_images(x, dir=None, filename="x", row=10, col=10):
if dir is None:
raise Exception()
try:
os.mkdir(dir)
except:
pass
fig = pylab.gcf()
fig.set_size_inches(col * 2, row * 2)
pylab.clf()
pylab.gray()
for m in range(row * col):
pylab.subplot(row, col, m + 1)
pylab.imshow(np.clip(x[m], 0, 1), interpolation="none")
pylab.axis("off")
pylab.savefig("{}/{}.png".format(dir, filename))
def tile_binary_images(x, dir=None, filename="x"):
if dir is None:
raise Exception()
try:
os.mkdir(dir)
except:
pass
fig = pylab.gcf()
fig.set_size_inches(16.0, 16.0)
pylab.clf()
pylab.gray()
for m in range(100):
pylab.subplot(10, 10, m + 1)
pylab.imshow(np.clip(x[m], 0, 1), interpolation="none")
pylab.axis("off")
pylab.savefig("{}/{}.png".format(dir, filename))
def plot_z(z, dir=None, filename="z", xticks_range=None, yticks_range=None):
if dir is None:
raise Exception()
try:
os.mkdir(dir)
except:
pass
fig = pylab.gcf()
fig.set_size_inches(16.0, 16.0)
pylab.clf()
for n in xrange(z.shape[0]):
result = pylab.scatter(z[n, 0], z[n, 1], s=40, marker="o", edgecolors='none')
pylab.xlabel("z1")
pylab.ylabel("z2")
if xticks_range is not None:
pylab.xticks(pylab.arange(-xticks_range, xticks_range + 1))
if yticks_range is not None:
pylab.yticks(pylab.arange(-yticks_range, yticks_range + 1))
pylab.savefig("{}/{}.png".format(dir, filename))
def visualize_x(reconstructed_x_batch, image_width=28, image_height=28, image_channel=1, dir=None):
if dir is None:
raise Exception()
try:
os.mkdir(dir)
except:
pass
fig = pylab.gcf()
fig.set_size_inches(16.0, 16.0)
pylab.clf()
if image_channel == 1:
pylab.gray()
for m in range(100):
pylab.subplot(10, 10, m + 1)
if image_channel == 1:
pylab.imshow(reconstructed_x_batch[m].reshape((image_width, image_height)), interpolation="none")
elif image_channel == 3:
pylab.imshow(reconstructed_x_batch[m].reshape((image_channel, image_width, image_height)), interpolation="none")
pylab.axis("off")
pylab.savefig("%s/reconstructed_x.png" % dir)
def visualize_labeled_z(z_batch, label_batch, dir=None):
fig = pylab.gcf()
fig.set_size_inches(20.0, 16.0)
pylab.clf()
colors = ["#2103c8", "#0e960e", "#e40402","#05aaa8","#ac02ab","#aba808","#151515","#94a169", "#bec9cd", "#6a6551"]
for n in xrange(z_batch.shape[0]):
result = pylab.scatter(z_batch[n, 0], z_batch[n, 1], c=colors[label_batch[n]], s=40, marker="o", edgecolors='none')
classes = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]
recs = []
for i in range(0, len(colors)):
recs.append(mpatches.Rectangle((0, 0), 1, 1, fc=colors[i]))
ax = pylab.subplot(111)
box = ax.get_position()
ax.set_position([box.x0, box.y0, box.width * 0.8, box.height])
ax.legend(recs, classes, loc="center left", bbox_to_anchor=(1.1, 0.5))
pylab.xticks(pylab.arange(-4, 5))
pylab.yticks(pylab.arange(-4, 5))
pylab.xlabel("z1")
pylab.ylabel("z2")
pylab.savefig("%s/labeled_z.png" % dir)
def on_epoch_end(self, epoch, logs={}):
self.model.save_weights(os.path.join(self.output_dir, 'weights%02d.h5' % (epoch)))
self.show_edit_distance(256)
word_batch = next(self.text_img_gen)[0]
res = decode_batch(self.test_func, word_batch['the_input'][0:self.num_display_words])
if word_batch['the_input'][0].shape[0] < 256:
cols = 2
else:
cols = 1
for i in range(self.num_display_words):
pylab.subplot(self.num_display_words // cols, cols, i + 1)
if K.image_dim_ordering() == 'th':
the_input = word_batch['the_input'][i, 0, :, :]
else:
the_input = word_batch['the_input'][i, :, :, 0]
pylab.imshow(the_input.T, cmap='Greys_r')
pylab.xlabel('Truth = \'%s\'\nDecoded = \'%s\'' % (word_batch['source_str'][i], res[i]))
fig = pylab.gcf()
fig.set_size_inches(10, 13)
pylab.savefig(os.path.join(self.output_dir, 'e%02d.png' % (epoch)))
pylab.close()
def plot(self):
"""Visualize the label images (e.g. for debugging)
:return: The current figure
"""
import pylab
pylab.imshow(self.image, interpolation='nearest')
return pylab.gcf()
def save_plots(self, folder):
import pylab as pl
pl.gcf().set_size_inches(15, 15)
pl.clf()
self.homography.plot_original()
pl.savefig(join(folder, 'homography-original.jpg'))
pl.clf()
self.homography.plot_rectified()
pl.savefig(join(folder, 'homography-rectified.jpg'))
pl.clf()
self.driving_layers.plot(overlay_alpha=0.7)
pl.savefig(join(folder, 'segnet-driving.jpg'))
pl.clf()
self.facade_layers.plot(overlay_alpha=0.7)
pl.savefig(join(folder, 'segnet-i12-facade.jpg'))
pl.clf()
self.plot_grids()
pl.savefig(join(folder, 'grid.jpg'))
pl.clf()
self.plot_regions()
pl.savefig(join(folder, 'regions.jpg'))
pl.clf()
pl.gcf().set_size_inches(6, 4)
self.plot_facade_cuts()
pl.savefig(join(folder, 'facade-cuts.jpg'), dpi=300)
pl.savefig(join(folder, 'facade-cuts.svg'))
imsave(join(folder, 'walls.png'), self.wall_colors)
def on_epoch_end(self, epoch, logs={}):
self.model.save_weights(os.path.join(self.output_dir, 'weights%02d.h5' % (epoch)))
self.show_edit_distance(256)
word_batch = next(self.text_img_gen)[0]
res = decode_batch(self.test_func, word_batch['the_input'][0:self.num_display_words])
if word_batch['the_input'][0].shape[0] < 256:
cols = 2
else:
cols = 1
for i in range(self.num_display_words):
pylab.subplot(self.num_display_words // cols, cols, i + 1)
if K.image_data_format() == 'channels_first':
the_input = word_batch['the_input'][i, 0, :, :]
else:
the_input = word_batch['the_input'][i, :, :, 0]
pylab.imshow(the_input.T, cmap='Greys_r')
pylab.xlabel('Truth = \'%s\'\nDecoded = \'%s\'' % (word_batch['source_str'][i], res[i]))
fig = pylab.gcf()
fig.set_size_inches(10, 13)
pylab.savefig(os.path.join(self.output_dir, 'e%02d.png' % (epoch)))
pylab.close()
def generateImages(picklefile, pickledir, filehash, imagedir, pietype):
leaf_file = open(os.path.join(pickledir, picklefile), 'rb')
(piedata, pielabels) = cPickle.load(leaf_file)
leaf_file.close()
pylab.figure(1, figsize=(6.5,6.5))
ax = pylab.axes([0.2, 0.15, 0.6, 0.6])
pylab.pie(piedata, labels=pielabels)
pylab.savefig(os.path.join(imagedir, '%s-%s.png' % (filehash, pietype)))
pylab.gcf().clear()
os.unlink(os.path.join(pickledir, picklefile))
def plot_channel(image, name, cmap='gist_heat', log=True, dex=3, zero_factor=1.0e-10,
label=None, label_color='w', label_size='large'):
"""
This function will plot a single channel. *image* is an array shaped like
(N,M), *name* is the pefix for the output filename. *cmap* is the name of
the colormap to apply, *log* is whether or not the channel should be
logged. Additionally, you may optionally specify the minimum-value cutoff
for scaling as *dex*, which is taken with respect to the minimum value of
the image. *zero_factor* applies a minimum value to all zero-valued
elements. Optionally, *label*, *label_color* and *label_size* may be
specified.
"""
import matplotlib
import pylab
Nvec = image.shape[0]
image[np.isnan(image)] = 0.0
ma = image[image>0.0].max()
image[image==0.0] = ma*zero_factor
if log:
mynorm = matplotlib.colors.LogNorm(ma/(10.**dex), ma)
pylab.clf()
pylab.gcf().set_dpi(100)
pylab.gcf().set_size_inches((Nvec/100.0, Nvec/100.0))
pylab.gcf().subplots_adjust(left=0.0, right=1.0, bottom=0.0, top=1.0, wspace=0.0, hspace=0.0)
mycm = pylab.cm.get_cmap(cmap)
if log:
pylab.imshow(image,cmap=mycm, norm=mynorm, interpolation='nearest')
else:
pylab.imshow(image,cmap=mycm, interpolation='nearest')
if label is not None:
pylab.text(20, 20,label, color = label_color, size=label_size)
pylab.savefig("%s_%s.png" % (name,cmap))
pylab.clf()
def zipf(self, message, users):
source_user = message.author.name
source_user = source_user.strip('@').split('#')[0]
target_users = [user.strip('@').split('#')[0] for user in users.split()]
if len(users) == 0:
target_users = [source_user]
if users == '*':
if message.server is not None:
target_users = [member.name for member in message.server.members]
target_users = [user for user in target_users if self.check_nickname_valid(user.lower()) is None]
image_file_name = self.quotes_file_name(source_user.lower())[:-4] + '.png'
pylab.title('Word frequencies')
for user in target_users:
quotes_file = codecs.open(self.quotes_file_name(user.lower()), 'r', encoding='utf-8')
lines = quotes_file.readlines()
quotes_file.close()
if len(lines) < 20:
continue
tokenizer = nltk.tokenize.RegexpTokenizer(r'\w+')
tokens = self.filter_to_english_words(tokenizer.tokenize(str(lines)))
if len(tokens) < 200:
continue
freq = nltk.FreqDist(tokens)
self.plot_word_frequencies(freq, user)
pylab.legend()
pylab.savefig(image_file_name)
pylab.gcf().clear()
await self.client.send_file(message.channel, image_file_name)
def drawTwoDf(pl, df1, df2, title=''):
"""?????df"""
pl.figure
pl.rc('font', family='simhei')
if title != '':
if agl.is_utf8(title):
title = title.decode('utf8')
fig = pl.gcf()
ax1 = fig.add_subplot(211)
df1.plot(ax=ax1, title=title)
ax2 = fig.add_subplot(212)
df2.plot(ax=ax2)
pl.show()
pl.close()