code: def plot_calibration(y_true, y_pred, ax=None):
      """Plot the calibration of a probabilistic forecast.
  
      Calculates internally the calibration of the quantile forecast and
      visualise it.
  
      x-axis: interval from 0 to 1
      y-axis: interval from 0 to 1
      plot elements: the calibration fo the forecast (blue) and the ideal
          calibration (orange)
  
      Parameters
      ----------
      y_true : pd.Series, single columned pd.DataFrame, or single columned np.array.
          The actual values of the forecast
      y_pred : pd.DataFrame
          The quantile forecast.
      ax : matplotlib.axes.Axes, optional (default=None)
          Axes on which to plot. If None, axes will be created and returned.
  
      Returns
      -------
      fig : matplotlib.figure.Figure, returned only if ax is None
          matplotlib figure object
      ax : matplotlib.axes.Axes
          matplotlib axes object with the figure
      """
      import matplotlib.pyplot as plt
  
      series = convert_to(y_true, "pd.Series", "Series")
  
      _ax_kwarg_is_none = True if ax is None else False
  
      if _ax_kwarg_is_none:
          fig, ax = plt.subplots(1, figsize=plt.figaspect(0.25))
  
      result = [0]
      ideal_calibration = [0]
  
      for col in y_pred.columns:
          if isinstance(col, tuple):
              q = col[1]
          else:
              q = col
          pred_q = convert_to(y_pred[[col]], "pd.Series", "Series")
          result.append(
              sum(series.values < pred_q.values) / len(pred_q.values)
          )
          ideal_calibration.append(q)
      result.append(1)
      ideal_calibration.append(1)
  
      df = pd.DataFrame(
          {
              "Forecast's Calibration": result,
              "Ideal Calibration": ideal_calibration,
          },
          index=ideal_calibration,
      )
  
      df.plot(ax=ax)
  
      if _ax_kwarg_is_none:
          return fig, ax
      else:
          return ax
  
file_path: sktime/sktime/utils/plotting.py
imports: import math
  from warnings import simplefilter, warn
  import numpy
  import pandas
  from sktime.datatypes import convert_to
  from sktime.utils.validation._dependencies import _check_soft_dependencies
  from sktime.utils.validation.forecasting import check_interval_df, check_y
  from sktime.utils.validation.series import check_consistent_index_type
label_desc: Use image node_id 8 for calling a global function with example usage: plot_calibration(y_true, y_pred, ax) and returns: fig,  ax, ax