def _sort_distributions(plot_data, plot_labels, plot_colors, sort_type):
 if (sort_type == 'median'):
  sort_key = (lambda item: np.median(item[0]))
 elif (sort_type == 'alphabetical'):
  sort_key = (lambda item: item[1])
 else:
  raise ValueError(("Invalid sort type '%s'." % sort_type))
 return zip(*sorted(zip(plot_data, plot_labels, plot_colors), key=sort_key))

def _sort_distributions ( plot_data , plot_labels , plot_colors , sort_type ) : if ( sort_type == 'median' ) : sort_key = ( lambda item : np . median ( item [ 0 ] ) ) elif ( sort_type == 'alphabetical' ) : sort_key = ( lambda item : item [ 1 ] ) else : raise ValueError ( ( "Invalid sort type '%s'." % sort_type ) ) return zip ( * sorted ( zip ( plot_data , plot_labels , plot_colors ) , key = sort_key ) )
sort plot data .