plot_latent added for mrd