code: def plot_kernel_prediction(
      ax: Axes, kernel: gpflow.kernels.Kernel, *, optimise: bool = True
  ) -> None:
      X = np.array([[-0.5], [0.0], [0.4], [0.5]])
      Y = np.array([[1.0], [0.0], [0.6], [0.4]])
      model = gpflow.models.GPR(
          (X, Y), kernel=deepcopy(kernel), noise_variance=1e-3
      )
  
      if optimise:
          gpflow.set_trainable(model.likelihood, False)
          opt = gpflow.optimizers.Scipy()
          opt.minimize(model.training_loss, model.trainable_variables)
  
      Xplot = np.linspace(-0.6, 0.6, 100)[:, None]
  
      f_mean, f_var = model.predict_f(Xplot, full_cov=False)
      f_lower = f_mean - 1.96 * np.sqrt(f_var)
      f_upper = f_mean + 1.96 * np.sqrt(f_var)
  
      ax.scatter(X, Y, color="black")
      (mean_line,) = ax.plot(
          Xplot, f_mean, "-", label=kernel.__class__.__name__
      )
      color = mean_line.get_color()
      ax.plot(Xplot, f_lower, lw=0.1, color=color)
      ax.plot(Xplot, f_upper, lw=0.1, color=color)
      ax.fill_between(
          Xplot[:, 0],
          f_lower[:, 0],
          f_upper[:, 0],
          color=color,
          alpha=0.1,
      )
      ax.set_ylim(bottom=-1.0, top=2.0)
      ax.set_title("Example data fit")
  
file_path: GPflow/doc/sphinx/notebooks/getting_started/kernels.pct.py
imports: import os
  import warnings
  from copy import deepcopy
  import matplotlib.pyplot
  import numpy
  import tensorflow
  from matplotlib.axes import Axes
  from matplotlib.cm import coolwarm
  import gpflow
label_desc: Use image node_id 3 for calling a global function with example usage: plot_kernel_prediction(ax, kernel) without return types