def _format(formatter, x):
<EOL>formatter.create_dummy_axis()<EOL>formatter.set_locs([val for val in x if ~np.isnan(val)])<EOL>try:<EOL><INDENT>oom = int(formatter.orderOfMagnitude)<EOL><DEDENT>except AttributeError:<EOL><INDENT>oom = <NUM_LIT:0><EOL><DEDENT>labels = [formatter(tick) for tick in x]<EOL>pattern = re.compile(r'<STR_LIT>')<EOL>for i, label in enumerate(labels):<EOL><INDENT>match = pattern.search(label)<EOL>if match:<EOL><INDENT>labels[i] = pattern.sub('<STR_LIT>', label)<EOL><DEDENT><DEDENT>if oom:<EOL><INDENT>labels = ['<STR_LIT>'.format(s, oom) if s != '<STR_LIT:0>' else s<EOL>for s in labels]<EOL><DEDENT>return labels<EOL>
Helper to format and tidy up