def x_frame1D(X, plot_limits=None, resolution=None):
"""
Internal helper function for making plots, returns a set of input values to plot as well as lower and upper limits
"""
assert X.shape[1] == 1, \
'x_frame1D is defined for one-dimensional inputs'
if plot_limits is None:
(xmin, xmax) = (X.min(0), X.max(0))
(xmin, xmax) = (xmin - 0.2 * (xmax - xmin), xmax + 0.2 * (xmax
- xmin))
elif len(plot_limits) == 2:
(xmin, xmax) = plot_limits
else:
raise ValueError, 'Bad limits for plotting'
Xnew = np.linspace(xmin, xmax, resolution or 200)[:, None]
return (Xnew, xmin, xmax)
评论列表
文章目录