class_docstr: Plot functions for mixed type x & y axes:
  
  Methods:
      - bar
      - bar_stacked
      - lollipop
      - parallel
class_docstr_tok: ["Plot","functions","for","mixed","type","x","&","y","axes",":","Methods",":","-","bar","-","bar_stacked","-","lollipop","-","parallel"]
code: def _sort_categories(
      source,
      categorical_columns,
      categorical_order_by,
      categorical_order_ascending,
  ):
      is_string = isinstance(categorical_order_by, str)
      order_length = getattr(categorical_order_by, "__len__", None)
      # Sort the categories
      if is_string and categorical_order_by == "values":
          return PlotMixedTypeXY._sort_categories_by_value(
              source, categorical_columns, categorical_order_ascending
          )
      elif is_string and categorical_order_by == "labels":
          return source.sort_index(
              axis=0, ascending=categorical_order_ascending
          )
      # Manual sort
      elif not is_string and order_length is not None:
          return source.reindex(categorical_order_by, axis="index")
  
      raise ValueError(
          """Must be 'values', 'labels', or a list of values."""
      )
  
imports: import bokeh
  import pandas
  import numpy
  from chartify._core.colors import Color, color_palettes
  from chartify._core.axes import NumericalYMixin, NumericalXMixin
  from scipy.stats import gaussian_kde
label_desc: Use image node_id 5 for calling the PlotMixedTypeXY obj's underlying member method code with example usage: obj._sort_categories(source, categorical_columns, categorical_order_by, categorical_order_ascending) and returns: PlotMixedTypeXY, source, source