code: def plotSingleState(time, dimension, result, options):
      """
      Plot a single coordinate in the latent state vector
  
      Args:
          time: the time label
          dimension: the coordinate of the plot
          result: the fitted result from dlm class
          options: options for the plot, for details please refer to @dlm
      """
  
      # plot fitered results if needed
      if options.plotFilteredData:
          start = result.filteredSteps[0]
          end = result.filteredSteps[1] + 1
          data = [
              item[dimension, 0]
              for item in result.filteredState[start:end]
          ]
          var = [
              abs(item[dimension, dimension])
              for item in result.filteredCov[start:end]
          ]
  
          plotData(
              time=time[start:end],
              data=data,
              showDataPoint=options.showFittedPoint,
              color=options.filteredColor,
              label="filtered state",
          )
  
          if options.showConfidenceInterval:
              upper, lower = getInterval(
                  data, var, p=options.confidence
              )
  
              plotInterval(
                  time=time[start:end],
                  upper=upper,
                  lower=lower,
                  intervalType=options.intervalType,
                  color=options.filteredColor,
              )
  
      # plot predicted results if needed
      if options.plotPredictedData:
          start = result.filteredSteps[0]
          end = result.filteredSteps[1] + 1
          data = [
              item[dimension, 0]
              for item in result.predictedState[start:end]
          ]
          var = [
              abs(item[dimension, dimension])
              for item in result.predictedCov[start:end]
          ]
  
          plotData(
              time=time[start:end],
              data=data,
              showDataPoint=options.showFittedPoint,
              color=options.predictedColor,
              label="predicted state",
          )
  
          if options.showConfidenceInterval:
              upper, lower = getInterval(
                  data, var, p=options.confidence
              )
  
              plotInterval(
                  time=time[start:end],
                  upper=upper,
                  lower=lower,
                  intervalType=options.intervalType,
                  color=options.predictedColor,
              )
  
      # plot smoothed results if needed
      if options.plotSmoothedData:
          start = result.smoothedSteps[0]
          end = result.smoothedSteps[1] + 1
          data = [
              item[dimension, 0]
              for item in result.smoothedState[start:end]
          ]
          var = [
              abs(item[dimension, dimension])
              for item in result.smoothedCov[start:end]
          ]
  
          plotData(
              time=time[start:end],
              data=data,
              showDataPoint=options.showFittedPoint,
              color=options.smoothedColor,
              label="smoothed state",
          )
  
          if options.showConfidenceInterval:
              upper, lower = getInterval(
                  data, var, p=options.confidence
              )
  
              plotInterval(
                  time=time[start:end],
                  upper=upper,
                  lower=lower,
                  intervalType=options.intervalType,
                  color=options.smoothedColor,
              )
  
      plt.legend(loc="best", shadow=True)
  
file_path: pydlm/pydlm/plot/dlmPlot.py
imports: import matplotlib.pyplot
  from pydlm.base.tools import getInterval
label_desc: Use image node_id 4 for calling a global function with example usage: plotSingleState(time, dimension, result, options) without return types