I am currently comparing evoked activity between two experimental conditions using the mne.viz.plot_compare_evokeds function. I want to change the x-axis limits to look closer on a certain time range, but the xlim label doesn’t work. Am I missing something?
You are right that plot_compare_evokeds() currently doesn’t support cropping the time axis to a user-specified region of interest. However, there are several ways to achieve what you want. I’ll just demonstrate here the one approach I personally find the most straightforward: we create a copy of your evokeds, crop those to the desired time range, and pass them to plot_compare_evokeds():
tmin = 0
tmax = 0.1
evokeds_to_plot = [e.copy().crop(tmin, tmax) for e in evokeds]
mne.viz.plot_compare_evokeds(evokeds_to_plot)
Here is a fully reproducible example using the MNE sample dataset: