code: def _plot_trace(self, samples, latent_samples):
      if self.log_dir is not None:
          fig, ax = plt.subplots(
              self.x_dim, 2, figsize=(10, self.x_dim), sharex=True
          )
          for i in range(self.x_dim):
              ax[i, 0].plot(samples[0, :, i])
              ax[i, 1].plot(latent_samples[0, 0:1000, i])
          plt.savefig(os.path.join(self.log_dir, "plots", "trace.png"))
          plt.close()
  
imports: from __future__ import print_function
  from __future__ import division
  import os
  import json
  import logging
  import time
  import torch
  import numpy
  from tqdm import tqdm
  import matplotlib.pyplot
  from nnest.trainer import Trainer
  from nnest.utils.evaluation import acceptance_rate, effective_sample_size, mean_jump_distance, gelman_rubin_diagnostic
  from nnest.utils.logger import create_logger, get_or_create_run_dir
label_desc: Use image node_id 4 for calling the Sampler obj's underlying member method code with example usage: obj._plot_trace(samples, latent_samples) without return types