docs: def plot_resp_diff(signal, rect_signal, sample_rate):
      """
      Function design to generate a Bokeh figure containing the evolution of RIP signal, when
      respiration was suspended for a long period, the rectangular signal that defines the
      stages of inhalation and exhalation and the first derivative of the RIP signal.
  
      Applied in the Notebook "Particularities of Inductive Respiration (RIP) Sensor ".
  
      ----------
      Parameters
      ----------
      signal : list
          List with the acquired RIP signal.
  
      rect_signal : list
          Data samples of the rectangular signal that identifies inhalation and exhalation
          segments.
  
      sample_rate : int
          Sampling rate of acquisition.
      """
  
      signal = numpy.array(signal) - numpy.average(signal)
      rect_signal = numpy.array(rect_signal)
      time = numpy.linspace(0, len(signal) / sample_rate, len(signal))
      signal_diff = numpy.diff(signal)
  
      # Inhalation and Exhalation time segments.
      # [Signal Binarization]
      rect_signal_rev = rect_signal - numpy.average(rect_signal)
      inhal_segments = numpy.where(rect_signal_rev >= 0)[0]
      exhal_segments = numpy.where(rect_signal_rev < 0)[0]
      rect_signal_rev[inhal_segments] = numpy.max(rect_signal_rev)
      rect_signal_rev[exhal_segments] = numpy.min(rect_signal_rev)
  
      # Normalized Data.
      norm_signal = signal / numpy.max(signal)
      norm_rect_signal = rect_signal_rev / numpy.max(rect_signal_rev)
      norm_signal_diff = signal_diff / numpy.max(signal_diff)
  
      # Smoothed Data.
      smooth_diff = smooth(signal_diff, int(sample_rate / 10))
      smooth_norm_diff = smooth(norm_signal_diff, int(sample_rate / 10))
  
      # Scaled Rectangular Signal.
      scaled_rect_signal = (rect_signal_rev * numpy.max(smooth_diff)) / numpy.max(rect_signal_rev)
  
      # [Signal Differentiation]
      diff_rect_signal = numpy.diff(rect_signal_rev)
      inhal_begin = numpy.where(diff_rect_signal > 0)[0]
      inhal_end = numpy.where(diff_rect_signal < 0)[0]
      exhal_begin = inhal_end
      exhal_end = inhal_begin[1:]
  
      # Generation of a Bokeh figure where data will be plotted.
      figure_list = plot([list([0]), list([0]), list([0])],
                                      [list([0]), list([0]), list([0])], gridPlot=True, gridLines=3,
                                      gridColumns=1, showPlot=False)
  
      # Edition of Bokeh figure (title, axes labels...)
      # [Top Figure]
      title = Title()
      title.text = "RIP Signal and Respiration Cycles"
      figure_list[0].title = title
  
      figure_list[0].line(time, signal, **opensignals_kwargs("line"))
  
      # [Plot of inhalation and exhalation segments]
      _inhal_exhal_segments(figure_list[0], list(time), list(rect_signal_rev), inhal_begin, inhal_end,
                            exhal_begin, exhal_end)
      figure_list[0].yaxis.axis_label = "Raw Data (without DC component)"
  
      # [Middle Figure]
      title = Title()
      title.text = "1st Derivative of RIP Signal and Respiration Cycles"
      figure_list[1].title = title
  
      figure_list[1].line(time[1:], smooth_diff, **opensignals_kwargs("line"))
  
      # [Plot of inhalation and exhalation segments]
      _inhal_exhal_segments(figure_list[1], list(time), list(scaled_rect_signal), inhal_begin,
                            inhal_end, exhal_begin, exhal_end)
      figure_list[1].yaxis.axis_label = "Raw Differential Data"
  
      # [Bottom Figure]
      title = Title()
      title.text = "RIP Signal and 1st Derivative (Normalized)"
      figure_list[2].title = title
  
      figure_list[2].line(time, norm_signal, **opensignals_kwargs("line"))
      figure_list[2].line(time[1:], smooth_norm_diff, legend="RIP 1st Derivative", **opensignals_kwargs("line"))
  
      # [Plot of inhalation and exhalation segments]
      _inhal_exhal_segments(figure_list[2], list(time), list(norm_rect_signal), inhal_begin,
                            inhal_end, exhal_begin, exhal_end)
      figure_list[2].yaxis.axis_label = "Normalized Data"
      figure_list[2].xaxis.axis_label = "Time (s)"
  
      grid_plot_ref = gridplot([[figure_list[0]], [figure_list[1]], [figure_list[2]]],
                               **opensignals_kwargs("gridplot"))
  
      show(grid_plot_ref)