def scatter2d(x,y,title='2dscatterplot',xlabel=None,ylabel=None):
fig=plt.figure()
plt.scatter(x,y)
plt.title(title)
if xlabel:
plt.xlabel(xlabel)
if ylabel:
plt.ylabel(ylabel)
if not 0<=np.min(x)<=np.max(x)<=1:
raise ValueError('summary_scatter2d title:',title,' input x exceeded [0,1] range.\
min:',np.min(x),' max:',np.max(x))
if not 0<=np.min(y)<=np.max(y)<=1:
raise ValueError('summary_scatter2d title:',title,' input y exceeded [0,1] range.\
min:',np.min(y),' max:',np.max(y))
plt.xlim([0,1])
plt.ylim([0,1])
return fig
评论列表
文章目录