print('Trying to make some plots using matplotlib plotting package') config.has_matplot() #check for matplot library #momentum distribution at start and end bunch_list[0] .matplot_histogram('p', 'MeV/c') bunch_list[-1].matplot_histogram('p', 'MeV/c') #energy-time scatter plot at start bunch_list[0].matplot_scatter_graph('t', 'energy', 'ns', 'MeV/c') #histogram at start; note that in the first instance it *looks* like a scatter plot #but it is not; hence I draw the same histogram twice, once as a pseudo-scatter #and once as a contour plot bunch_list[0].matplot_histogram('t', 'ns', 'energy', 'MeV/c') #evolution of RMS emittance in x along the beamline Bunch.matplot_graph(bunch_list, 'mean', ['z'], 'emittance', ['x'], 'm', 'mm') Bunch.matplot_graph(bunch_list, 'mean', ['z'], 'emittance', ['x','y'], 'm', 'mm') try: common.show_matplot_and_continue() except: #bug - if you have PyROOT and use python < 2.6, show_matplot_and_continue() fails pass # give up on matplot except ImportError: print("Matplotlib not detected - skipping matplotlib graphics") #now wait for user to review plots before ending print('Press <return> key to finish') input()