def full_plot(data, pi, phi, pi_at, save_name=None):
# Plot a single example.
f, (ax1, ax2, ax3, ax4) = pyplot.subplots(4, 1)
std_x = data_std * data + data_mean
# std_x = data
x = numpy.cumsum(std_x[:, 1])
y = numpy.cumsum(std_x[:, 2])
size_x = x.max() - x.min() + 1.
size_y = y.max() - y.min() + 1.
f.set_size_inches(5. * size_x / size_y, 20.)
cuts = numpy.where(std_x[:, 0] == 1)[0]
start = 0
for cut_value in cuts:
ax1.plot(
x[start:cut_value], y[start:cut_value], 'k-', linewidth=1.5)
start = cut_value + 1
ax1.axis('equal')
ax1.axes.get_xaxis().set_visible(False)
ax1.axes.get_yaxis().set_visible(False)
def plot_matrix(data, ax):
im = ax.imshow(
data.T, aspect='auto', origin='lower', interpolation='nearest')
cax = make_axes_locatable(ax).append_axes("right", size="1%", pad=0.05)
pyplot.colorbar(im, cax=cax)
plot_matrix(phi, ax2)
plot_matrix(pi_at, ax3)
plot_matrix(pi, ax4)
if save_name is None:
pyplot.show()
else:
try:
pyplot.savefig(
save_name,
bbox_inches='tight',
pad_inches=0.5)
except Exception:
print "Error building image!: " + save_name
pyplot.close()
评论列表
文章目录