def _save_2d_error_plot(self, detector, xlist, ylist, elist, x_axis_label, y_axis_label, z_axis_label):
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from matplotlib import colors
# configure logscale on X and Y axis (both for positive and negative numbers)
fig, ax = plt.subplots(1, 1)
if PlotAxis.x in self.axis_with_logscale:
plt.xscale('symlog')
if PlotAxis.y in self.axis_with_logscale:
plt.yscale('symlog')
if PlotAxis.z in self.axis_with_logscale:
norm = colors.LogNorm(vmin=elist[elist > 0].min(), vmax=elist.max())
else:
norm = colors.Normalize(vmin=elist.min(), vmax=elist.max())
plt.xlabel(x_axis_label)
plt.ylabel(y_axis_label)
mesh = plt.pcolormesh(xlist, ylist, elist.clip(0.0), cmap=self.colormap, norm=norm)
cbar = fig.colorbar(mesh)
cbar.set_label(label=z_axis_label, rotation=270, verticalalignment='bottom')
base_name, _ = os.path.splitext(self.plot_filename)
plt.savefig(base_name + "_error.png")
plt.close()
评论列表
文章目录