class_docstr: This is the matplotlib based GUI for a single analysis
  It assumes the analysis is simple image data (this could be abstracted)
class_docstr_tok: ["This","is","the","matplotlib","based","GUI","for","a","single","analysis","It","assumes","the","analysis","is","simple","image","data","(","this","could","be","abstracted",")"]
docstr: Set the initial embedding and point weights
  to create and display the plot at iteration step=0
docstr_tok: ["Set","the","initial","embedding","and","point","weights","to","create","and","display","the","plot","at","iteration","step=0"]
code: def init_plot(
      self,
      embedding,
      weights,
      on_selection,
      on_close,
      disable_select,
      top_level=False,
      labels=None,
      color_norm=None,
  ):
      """Set the initial embedding and point weights
      to create and display the plot at iteration step=0"""
      # pylint: disable=attribute-defined-outside-init
      self.top_level = top_level
      self.labels = labels
      self.color_norm = color_norm
      self.disable_select = disable_select
      self.selection_mask = np.full(weights.shape, False)
  
      # Plot and image definition
      # self.rect = None
      self.extent = 2.8
      self.cleanup = True
      self.rectangle_selector = None
      self.lasso_selector = None
  
      # Callbacks
      self.fig.canvas.mpl_connect("motion_notify_event", self.on_over)
      self.fig.canvas.mpl_connect("key_press_event", self.on_keypress)
      self.fig.canvas.mpl_connect(
          "button_press_event", self.on_start_select
      )
      self.fig.canvas.mpl_connect("close_event", self.handle_close)
  
      # Brush support values
      self.in_selection = False
      self.in_paint = False
      self.dim_xy = (None, None)  # displacement
      self.rorg_xy = (None, None)  # The bottom left corner
  
      print("Show plot")
      plt.show(
          block=False
      )  # Need no block for cooperation with tkinter
  
      self.embedding = embedding
      self.on_selection = on_selection
      self.on_close = on_close
      # pylint: enable=attribute-defined-outside-init
      x = embedding[:, 0]
      y = embedding[:, 1]
      if self.labels is None:
          self.scatter = self.ax.scatter(
              x, y, s=weights * 8, c="b", alpha=0.4, picker=10
          )
      else:
          self.scatter = self.ax.scatter(
              x,
              y,
              s=weights * 8,
              c=self.labels,
              # TODO make color map user selectable pylint: disable=fixme
              cmap=plt.cm.rainbow_r,  # # pylint: disable=no-member
              norm=self.color_norm,
              alpha=0.4,
              picker=10,
          )
  
      self.update_scatter_plot_limits(embedding)
  
      # Drawing selectors
      rectangle_selector = RectangleSelector(
          self.ax,
          self.on_end_rectangle_select,
          drawtype="box",
          useblit=True,
          button=[1, 3],
          rectprops=dict(
              facecolor=(1, 0, 0, 0.1),
              edgecolor=(1, 0, 0, 0.5),
              fill=False,
          ),
          minspanx=5,
          minspany=5,
          spancoords="pixels",
      )
      lasso_selector = LassoSelector(
          self.ax,
          onselect=self.on_end_lasso_select,
          lineprops=dict(color=(1, 0, 0, 0.5)),
      )
      ellipse_selector = EllipseSelector(
          self.ax,
          onselect=self.on_end_ellipse_select,
          drawtype="line",
          lineprops=dict(color=(1, 0, 0, 0.5)),
      )
      polygon_selector = PolygonSelector(
          self.ax,
          onselect=self.on_end_lasso_select,
          lineprops=dict(color=(1, 0, 0, 0.5)),
      )
  
      self.selectors = {
          DrawingShape.Lasso: lasso_selector,
          DrawingShape.Ellipse: ellipse_selector,
          DrawingShape.Rectangle: rectangle_selector,
          DrawingShape.Polygon: polygon_selector,
      }
      # pylint: disable=attribute-defined-outside-init
      self.set_selector()
      # force rendering of facecolors
      self.fig.canvas.draw()
      self.facecolors = self.scatter.get_facecolors()
  
imports: import io
  from enum import Enum
  import numpy
  import matplotlib.pyplot
  import matplotlib.style
  from matplotlib.widgets import RectangleSelector, LassoSelector, EllipseSelector, PolygonSelector
  from matplotlib.path import Path
  from matplotlib.backends.backend_qt5agg import FigureCanvas
  from matplotlib.figure import Figure
  from PyQt5 import QtWidgets, QtCore
  from cursors import DrawingCursors, DrawingShape, DrawingMode
label_desc: Use image node_id 3 for calling the EmbeddingGui obj's underlying member method code with example usage: obj.init_plot(embedding, weights, on_selection, on_close, disable_select, top_level, labels, color_norm) without return types