class_docstr: A dlm module containing all plot methods
      
docstr: The main plot function. The dlmPlot and the matplotlib will only be loaded
  when necessary.
  
  Args:
      name: component to plot. Default to 'main', in which we plot the
            filtered time series. If a component name is given
            It plots the mean of the component, i.e., the observed value
            that attributes to that particular component, which equals to
            evaluation * latent states for that particular component.
docstr_tok: ["The","main","plot","function",".","The","dlmPlot","and","the","matplotlib","will","only","be","loaded","when","necessary",".","Args",":","name",":","component","to","plot",".","Default","to","'main","'",",","in","which","we","plot","the","filtered","time","series",".","If","a","component","name","is","given","It","plots","the","mean","of","the","component",",","i.e.",",","the","observed","value","that","attributes","to","that","particular","component",",","which","equals","to","evaluation","*","latent","states","for","that","particular","component","."]
code: def plot(self, name="main"):
      """The main plot function. The dlmPlot and the matplotlib will only be loaded
      when necessary.
  
      Args:
          name: component to plot. Default to 'main', in which we plot the
                filtered time series. If a component name is given
                It plots the mean of the component, i.e., the observed value
                that attributes to that particular component, which equals to
                evaluation * latent states for that particular component.
  
      """
  
      # load the library only when needed
      # import pydlm.plot.dlmPlot as dlmPlot
      self.loadPlotLibrary()
  
      if self.time is None:
          time = range(len(self.data))
      else:
          time = self.time
  
      # initialize the figure
      dlmPlot.plotInitialize()
  
      # change option setting if some results are not available
      if not self.initialized:
          raise NameError(
              "The model must be constructed and"
              + " fitted before ploting."
          )
  
      # check the filter status and automatically turn off bad plots
      self._checkPlotOptions()
  
      # plot the main time series after filtering
      if name == "main":
          # if we just need one plot
          if self.options.separatePlot is not True:
              dlmPlot.plotInOneFigure(
                  time=time,
                  data=self.data,
                  result=self.result,
                  options=self.options,
              )
          # otherwise, we plot in multiple figures
          else:
              dlmPlot.plotInMultipleFigure(
                  time=time,
                  data=self.data,
                  result=self.result,
                  options=self.options,
              )
  
      # plot the component after filtering
      elif self._checkComponent(name):
          # create the data for ploting
          data = {}
          if self.options.plotFilteredData:
              data["filteredMean"] = self.getMean(
                  filterType="forwardFilter", name=name
              )
              data["filteredVar"] = self.getVar(
                  filterType="forwardFilter", name=name
              )
  
          if self.options.plotSmoothedData:
              data["smoothedMean"] = self.getMean(
                  filterType="backwardSmoother", name=name
              )
              data["smoothedVar"] = self.getVar(
                  filterType="backwardSmoother", name=name
              )
  
          if self.options.plotPredictedData:
              data["predictedMean"] = self.getMean(
                  filterType="predict", name=name
              )
              data["predictedVar"] = self.getVar(
                  filterType="predict", name=name
              )
  
          if len(data) == 0:
              raise NameError(
                  "Nothing is going to be drawn, due to "
                  + "user choices."
              )
          data["name"] = name
          dlmPlot.plotComponent(
              time=time,
              data=data,
              result=self.result,
              options=self.options,
          )
      dlmPlot.plotout()
  
file_path: pydlm/pydlm/plot/dlmPlotMod.py
imports: from pydlm.core._dlm import _dlm
label_desc: Use image node_id 8 for calling the dlmPlotModule obj's underlying member method code with example usage: obj.plot(name) without return types