docstr:  Draw information of field value distribution for categorical type to
   the report.
   Details see analyzers inside `xai.data_explorer.categorical_analyzer`
  
  Args:
       notes(str): Explain the block
       field_name (str): data field name
       field_distribution (:dict of :CategoricalStats):
           -key: label_name
           -value: CategoricalStats object
       max_values_display (int): maximum number of values displayed
       colors (list): the list of color code for rendering different class
   
docstr_tok: ["Draw","information","of","field","value","distribution","for","categorical","type","to","the","report",".","Details","see","analyzers","inside","`","xai.data_explorer.categorical_analyzer","`","Args",":","notes","(","str",")",":","Explain","the","block","field_name","(","str",")",":","data","field","name","field_distribution","(",":","dict","of",":","CategoricalStats",")",":","-key",":","label_name","-value",":","CategoricalStats","object","max_values_display","(","int",")",":","maximum","number","of","values","displayed","colors","(","list",")",":","the","list","of","color","code","for","rendering","different","class"]
code: def draw_categorical_field_distribution(
      self,
      notes: str,
      *,
      field_name: str,
      field_distribution: Dict[str, CategoricalStats],
      max_values_display=20,
      colors=None,
  ):
      """
       Draw information of field value distribution for categorical type to
       the report.
       Details see analyzers inside `xai.data_explorer.categorical_analyzer`
  
      Args:
           notes(str): Explain the block
           field_name (str): data field name
           field_distribution (:dict of :CategoricalStats):
               -key: label_name
               -value: CategoricalStats object
           max_values_display (int): maximum number of values displayed
           colors (list): the list of color code for rendering different class
      """
      from xai.graphs import graph_generator
  
      if colors is None:
          colors = [
              "Blues_d",
              "Reds_d",
              "Greens_d",
              "Purples_d",
              "Oranges_d",
          ]
      # -- Draw Content --
      self.pdf.add_new_line(notes)
      self.pdf.start_itemize(" - ")
      for idx, (label_name, cat_stats) in enumerate(
          field_distribution.items()
      ):
          frequency_distribution = cat_stats.frequency_count
          if (
              len(frequency_distribution)
              / sum(frequency_distribution.values())
              > 0.5
          ):
              self.pdf.start_itemize("-")
              self.pdf.add_new_line(
                  "Warning: %s unique values found in %s samples."
                  % (
                      len(frequency_distribution),
                      sum(frequency_distribution.values()),
                  )
              )
              self.pdf.end_itemize()
              break
  
          if len(field_distribution) > max_values_display:
              self.pdf.add_new_line(
                  "%s of %s are displayed)"
                  % (max_values_display, len(field_distribution))
              )
  
          figure_path = "%s/%s_%s_field_distribution.png" % (
              self.figure_path,
              field_name,
              label_name,
          )
          image_path = graph_generator.BarPlot(
              file_path=figure_path,
              data=frequency_distribution,
              title="",
              x_label="",
              y_label=field_name,
          ).draw(
              limit_length=max_values_display,
              color_palette=colors[idx % len(colors)],
          )
          self.pdf.add_large_image(
              image_path=image_path,
              caption="For %s samples" % label_name,
              style="I",
          )
      self.pdf.end_itemize()
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import copy
  import os
  import tempfile
  import warnings
  import numpy
  import shutil
  from typing import Tuple, Dict, List
  from xai import MODE
  from xai.data.constants import DatetimeResolution
  from xai.data.explorer import CategoricalStats, NumericalStats, TextStats, DatetimeStats
  from xai.formatter.contents import Title, SectionTitle, Header
  from xai.formatter.portable_document.publisher import CustomPdf
  from xai.formatter.report.section import OverviewSection, DetailSection
  from xai.formatter.writer import Writer
label_desc: Use image node_id 19 for calling the PdfWriter obj's underlying member method code with example usage: obj.draw_categorical_field_distribution(notes) without return types