def plot(self, fig=None):
if not fig:<EOL><INDENT>fig = plt.gcf()<EOL><DEDENT>fig.subplots_adjust(left=<NUM_LIT:0.1>, right=<NUM_LIT>, top=<NUM_LIT>, bottom=<NUM_LIT>)<EOL>ax = fig.add_subplot(<NUM_LIT:1>, <NUM_LIT:1>, <NUM_LIT:1>)<EOL>sorted_overlapping_ports = sorted(<EOL>[(p, self.results['<STR_LIT>'][p]) for p in self.machine['<STR_LIT>']],<EOL>key=lambda x: x[<NUM_LIT:1>])<EOL>yticks_labels = []<EOL>yticks = []<EOL>xticks_labels = []<EOL>xticks = []<EOL>height = <NUM_LIT><EOL>i = <NUM_LIT:0><EOL>colors = ([(<NUM_LIT> / <NUM_LIT:255>, <NUM_LIT> / <NUM_LIT>, <NUM_LIT> / <NUM_LIT>)] +<EOL>[(<NUM_LIT> / <NUM_LIT>, <NUM_LIT> / <NUM_LIT>, <NUM_LIT> / <NUM_LIT>)] * (len(sorted_overlapping_ports) - <NUM_LIT:1>))<EOL>for p, c in sorted_overlapping_ports:<EOL><INDENT>ax.barh(i, c, height, align='<STR_LIT>', color=colors.pop(),<EOL>edgecolor=(<NUM_LIT:0.5>, <NUM_LIT:0.5>, <NUM_LIT:0.5>), linestyle='<STR_LIT>')<EOL>if i == len(sorted_overlapping_ports) - <NUM_LIT:1>:<EOL><INDENT>ax.text(c / <NUM_LIT>, i, '<STR_LIT>', ha='<STR_LIT>', va='<STR_LIT>')<EOL><DEDENT>yticks_labels.append(p)<EOL>yticks.append(i)<EOL>i += <NUM_LIT:1><EOL><DEDENT>xticks.append(sorted_overlapping_ports[-<NUM_LIT:1>][<NUM_LIT:1>])<EOL>xticks_labels.append('<STR_LIT>'.format(sorted_overlapping_ports[-<NUM_LIT:1>][<NUM_LIT:1>]))<EOL>y = <NUM_LIT:0><EOL>colors = [(<NUM_LIT> / <NUM_LIT>, <NUM_LIT:255> / <NUM_LIT>, <NUM_LIT> / <NUM_LIT>)] * (len(self.results['<STR_LIT>'])) +[(<NUM_LIT> / <NUM_LIT:255>, <NUM_LIT> / <NUM_LIT>, <NUM_LIT> / <NUM_LIT>)]<EOL>for k, v in [('<STR_LIT>', self.results['<STR_LIT>'])] + self.results['<STR_LIT>']:<EOL><INDENT>ax.barh(i, v, height, y, align='<STR_LIT>', color=colors.pop())<EOL>ax.text(y + v / <NUM_LIT>, i, '<STR_LIT>' + k + '<STR_LIT>', ha='<STR_LIT>', va='<STR_LIT>')<EOL>xticks.append(y + v)<EOL>xticks_labels.append('<STR_LIT>'.format(y + v))<EOL>y += v<EOL><DEDENT>yticks_labels.append('<STR_LIT>')<EOL>yticks.append(i)<EOL>ax.tick_params(axis='<STR_LIT:y>', which='<STR_LIT>', left='<STR_LIT>', right='<STR_LIT>')<EOL>ax.tick_params(axis='<STR_LIT:x>', which='<STR_LIT>', top='<STR_LIT>')<EOL>ax.set_xlabel('<STR_LIT>')<EOL>ax.set_ylabel('<STR_LIT>')<EOL>ax.set_yticks(yticks)<EOL>ax.set_yticklabels(yticks_labels)<EOL>ax.set_xticks(xticks)<EOL>ax.set_xticklabels(xticks_labels, rotation='<STR_LIT>')<EOL>ax.xaxis.grid(alpha=<NUM_LIT>, linestyle='<STR_LIT>')<EOL>fig.savefig(self._args.ecm_plot)<EOL>
Plot visualization of model prediction.