code: def run(self, workspace):
      import matplotlib
      import matplotlib.cm
      import matplotlib.backends.backend_agg
      import matplotlib.transforms
      from cellprofiler.gui.tools import (
          figure_to_image,
          only_display_image,
      )
  
      #
      # Get the image
      #
      image = workspace.image_set.get_image(self.image_name.value)
      if self.wants_image:
          pixel_data = image.pixel_data
      else:
          pixel_data = numpy.zeros(image.pixel_data.shape[:2])
      object_set = workspace.object_set
      if self.objects_or_image == OI_OBJECTS:
          if self.objects_name.value in object_set.get_object_names():
              objects = object_set.get_objects(self.objects_name.value)
          else:
              objects = None
      workspace.display_data.pixel_data = pixel_data
      if self.use_color_map():
          workspace.display_data.labels = objects.segmented
      #
      # Get the measurements and positions
      #
      measurements = workspace.measurements
      if self.objects_or_image == OI_IMAGE:
          value = measurements.get_current_image_measurement(
              self.measurement.value
          )
          values = [value]
          x = [pixel_data.shape[1] / 2]
          x_offset = numpy.random.uniform(high=1.0, low=-1.0)
          x[0] += x_offset
          y = [pixel_data.shape[0] / 2]
          y_offset = numpy.sqrt(1 - x_offset**2)
          y[0] += y_offset
      else:
          values = measurements.get_current_measurement(
              self.objects_name.value, self.measurement.value
          )
          if objects is not None:
              if len(values) < objects.count:
                  temp = numpy.zeros(objects.count, values.dtype)
                  temp[: len(values)] = values
                  temp[len(values) :] = numpy.nan
                  values = temp
              elif len(values) > objects.count:
                  # If the values for something (say, object number) are greater
                  # than the actual number of objects we have, some might have been
                  # filtered out/removed. We'll need to diff the arrays to figure out
                  # what objects to remove
                  indices = objects.indices
                  diff = numpy.setdiff1d(
                      indices, numpy.unique(objects.segmented)
                  )
                  values = numpy.delete(values, diff)
          x = measurements.get_current_measurement(
              self.objects_name.value, M_LOCATION_CENTER_X
          )
          x_offset = numpy.random.uniform(
              high=1.0, low=-1.0, size=x.shape
          )
          y_offset = numpy.sqrt(1 - x_offset**2)
          x += self.offset.value * x_offset
          y = measurements.get_current_measurement(
              self.objects_name.value, M_LOCATION_CENTER_Y
          )
          y += self.offset.value * y_offset
          if numpy.issubdtype(values.dtype, str):
              if self.use_color_map():
                  raise NotImplementedError(
                      "Cannot interpret a text measurement for display with a color scale"
                  )
              mask = ~(numpy.isnan(x) | numpy.isnan(y))
          else:
              mask = ~(
                  numpy.isnan(values) | numpy.isnan(x) | numpy.isnan(y)
              )
          values = values[mask]
          x = x[mask]
          y = y[mask]
          workspace.display_data.mask = mask
      workspace.display_data.values = values
      workspace.display_data.x = x
      workspace.display_data.y = y
      fig = matplotlib.figure.Figure()
      axes = fig.add_subplot(1, 1, 1)
  
      def imshow_fn(pixel_data):
          # Note: requires typecast to avoid failure during
          #       figure_to_image (IMG-764)
          img = pixel_data * 255
          img[img < 0] = 0
          img[img > 255] = 255
          img = img.astype(numpy.uint8)
          axes.imshow(img, cmap=matplotlib.cm.get_cmap("Greys"))
  
      self.display_on_figure(workspace, axes, imshow_fn)
  
      canvas = matplotlib.backends.backend_agg.FigureCanvasAgg(fig)
      if self.saved_image_contents == E_AXES:
          fig.set_frameon(False)
          if not self.use_color_map():
              fig.subplots_adjust(0.1, 0.1, 0.9, 0.9, 0, 0)
          shape = pixel_data.shape
          width = float(shape[1]) / fig.dpi
          height = float(shape[0]) / fig.dpi
          fig.set_figheight(height)
          fig.set_figwidth(width)
      elif self.saved_image_contents == E_IMAGE:
          if self.use_color_map():
              fig.axes[1].set_visible(False)
          only_display_image(fig, pixel_data.shape)
      else:
          if not self.use_color_map():
              fig.subplots_adjust(0.1, 0.1, 0.9, 0.9, 0, 0)
  
      pixel_data = figure_to_image(fig, dpi=fig.dpi)
      image = Image(pixel_data)
      workspace.image_set.add(self.display_image.value, image)
  
imports: import matplotlib.axes
  import matplotlib.cm
  import matplotlib.figure
  import matplotlib.text
  import numpy
  from cellprofiler_core.constants.measurement import C_FILE_NAME
  from cellprofiler_core.constants.measurement import C_PATH_NAME
  from cellprofiler_core.constants.measurement import M_LOCATION_CENTER_X
  from cellprofiler_core.constants.measurement import M_LOCATION_CENTER_Y
  from cellprofiler_core.image import FileImage
  from cellprofiler_core.image import Image
  from cellprofiler_core.module import Module
  from cellprofiler_core.preferences import get_default_colormap
  from cellprofiler_core.setting import Binary
  from cellprofiler_core.setting import Color
  from cellprofiler_core.setting import Measurement
  from cellprofiler_core.setting.choice import Choice
  from cellprofiler_core.setting.choice import Colormap
  from cellprofiler_core.setting.range import FloatRange
  from cellprofiler_core.setting.subscriber import ImageSubscriber
  from cellprofiler_core.setting.subscriber import LabelSubscriber
  from cellprofiler_core.setting.text import ImageName
  from cellprofiler_core.setting.text import Integer
label_desc: Use image node_id 5 for calling the DisplayDataOnImage obj's underlying member method code with example usage: obj.run(workspace) without return types