print("Number of filtered peaks: ", len(new_peak_list)) # Creating the plot proceeds much as before, except that # `ClickEventHandler(peak_list=new_peak_list)` must be called before `plt.show()`. # # You should also assign this to a variable to prevent it being garbage collected. # In[6]: # 3rd party from pyms.Display import ClickEventHandler fig, ax = plt.subplots(1, 1, figsize=(8, 5)) # Plot the TIC plot_ic(ax, tic, label="TIC") # Plot the peaks plot_peaks(ax, new_peak_list) # Set the title ax.set_title("TIC for gc01_0812_066 with Detected Peaks") # Set up the ClickEventHandler handler = ClickEventHandler(new_peak_list) # Add the legend plt.legend() plt.show()
# Extract the desired IonChromatograms from the `IntensityMatrix`. # In[2]: ic73 = im.get_ic_at_mass(73) ic147 = im.get_ic_at_mass(147) # Import matplotlib and the `plot_ic()` function, create a subplot, and plot the ICs on the chart: # In[3]: # 3rd party import matplotlib.pyplot as plt from pyms.Display import plot_ic fig, ax = plt.subplots(1, 1, figsize=(8, 5)) # Plot the ICs plot_ic(ax, tic, label="TIC") plot_ic(ax, ic73, label="m/z 73") plot_ic(ax, ic147, label="m/z 147") # Set the title ax.set_title("TIC and ICs for m/z = 73 & 147") # Add the legend plt.legend() plt.show()
pl = rel_threshold(peak_list, percent=2) new_peak_list = num_ions_threshold(pl, n=3, cutoff=10000) print("Number of filtered peaks: ", len(new_peak_list)) # Get Ion Chromatograms for 4 separate m/z channels. ic191 = im.get_ic_at_mass(191) ic73 = im.get_ic_at_mass(73) ic57 = im.get_ic_at_mass(57) ic55 = im.get_ic_at_mass(55) # Create a subplot and plot the TIC and peaks fig, ax = plt.subplots(1, 1) # Plot the ICs plot_ic(ax, tic, label="TIC") plot_ic(ax, ic191, label="m/z 191") plot_ic(ax, ic73, label="m/z 73") plot_ic(ax, ic57, label="m/z 57") plot_ic(ax, ic55, label="m/z 55") # Plot the peaks plot_peaks(ax, new_peak_list) # Set the title ax.set_title('TIC, ICs, and PyMS Detected Peaks') # Add the legend plt.legend() # Show the plot