import numpy as np import matplotlib.pyplot as plt #Finish function for quick plotting 2-5 plots on a single chart #def simplyPlot (list1, list2, #ppm x1 = [300, 400, 500, 600, 700, 800, 900, 1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000]; #win x2 = [200, 300, 400, 500, 600, 700, 800, 900, 1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000]; #hw #Rs/Ro #Winsen MQ4 y1 = [0.25, 0.2, 0.175, 0.15, 0.135, 0.125, 0.11, 0.1, 0.075, 0.055, 0.0475, 0.04, 0.0375, 0.035, 0.0325, 0.029, 0.028]; #Hanwei MQ4 y2 = [1.75, 1.6, 1.5, 1.45, 1.35, 1.25, 1.15, 1.05, 1, 0.78, 0.68, 0.62, 0.58, 0.55, 0.5, 0.47, 0.46, 0.45]; y1Max = max(y1); y2Max = max(y2); #normalized Rs/Ro y1Norm = [y / y1Max for y in y1]; y2Norm = [y / y2Max for y in y2]; # Create normalized plots with pre-defined labels. fig, ax1 = plt.subplots() ax1.plot(x1, y1Norm, '-o', label='Winsen MQ4') ax1.plot(x2, y2Norm, '--x', label='Hanwei MQ4') ax1.set_xlabel('ppm'); ax1.set_ylabel('Rs/Ro'); ax1.set_title('Noramlized Sense to Nominal Resistance'); ax1.grid(); legend = ax1.legend(loc='upper right', shadow=True, fontsize='x-large') # Put a nicer background color on the legend. legend.get_frame().set_facecolor('whitesmoke') plt.show() #Create plot for Rs/Ro for Winsen fig, ax2 = plt.subplots() ax2.plot(x1, y1, '-o') ax2.set_xlabel('ppm'); ax2.set_ylabel('Rs/Ro'); ax2.set_title('Sense to Nominal Resistance (Winsen)'); ax2.grid(); # Put a nicer background color on the legend. plt.show() # Create plot Rs/Ro for Hanwei fig, ax3 = plt.subplots() ax3.plot(x2, y2, '--x') ax3.set_xlabel('ppm'); ax3.set_ylabel('Rs/Ro'); ax3.set_title('Sense to Nominal Resistance (Hanwei)'); ax3.grid(); # Put a nicer background color on the legend. plt.show()