Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lära Comparing and Presenting Experimental Results | Spectra and Reaction Analysis
Python for Chemists

bookComparing and Presenting Experimental Results

When you conduct multiple experiments — such as measuring absorbance spectra from different samples or under varying conditions — it's essential to compare your results effectively. This allows you to identify patterns, differences, or similarities that may reveal important chemical information. By overlaying spectra on a single plot, you can visually assess how changes in conditions or sample composition affect the absorbance at different wavelengths.

1234567891011121314151617181920
import numpy as np import matplotlib.pyplot as plt # Simulated wavelength range (nm) wavelength = np.linspace(200, 800, 300) # Simulated absorbance spectra for three samples abs1 = np.exp(-0.01 * (wavelength - 350) ** 2) * 1.0 abs2 = np.exp(-0.01 * (wavelength - 400) ** 2) * 0.8 abs3 = np.exp(-0.01 * (wavelength - 450) ** 2) * 0.6 plt.figure(figsize=(8, 5)) plt.plot(wavelength, abs1, label="Sample 1") plt.plot(wavelength, abs2, label="Sample 2") plt.plot(wavelength, abs3, label="Sample 3") plt.xlabel("Wavelength (nm)") plt.ylabel("Absorbance") plt.title("Comparison of Absorbance Spectra") plt.legend() plt.show()
copy

When plotting multiple spectra together, it's important to help viewers quickly distinguish between the different experiments. Using a legend is the standard way to label each curve, so anyone reading your plot knows which line corresponds to which sample or condition. Color coding each spectrum and using distinct line styles (such as solid, dashed, or dotted lines) make the plot even clearer, especially if some viewers have color vision deficiencies or if the plot is printed in grayscale.

12345678910111213
plt.figure(figsize=(8, 5)) plt.plot(wavelength, abs1, color="blue", linestyle="-", linewidth=2, label="Sample 1: Control") plt.plot(wavelength, abs2, color="green", linestyle="--", linewidth=2, label="Sample 2: Heated") plt.plot(wavelength, abs3, color="red", linestyle=":", linewidth=2, label="Sample 3: With Additive") plt.xlabel("Wavelength (nm)") plt.ylabel("Absorbance") plt.title("Absorbance Spectra Under Different Conditions") plt.legend(loc="upper right", title="Samples") plt.annotate("Peak shifts", xy=(400, 0.8), xytext=(500, 0.9), arrowprops=dict(facecolor='black', arrowstyle="->"), fontsize=10, color="black") plt.tight_layout() plt.show()
copy

To present scientific results clearly, you should always consider the needs of your audience. Use descriptive axis labels (with units), an informative title, and a legend that explains each curve. Choose colors and line styles that remain distinguishable in both color and black-and-white formats. Annotations can highlight important features, such as peaks or shifts in the spectra, drawing attention to key findings. Consistent formatting across all your figures helps your work appear professional and makes your results easier to interpret.

Note
Study More

In this course, we briefly touched on many Python libraries that are important for effective analysis. To deepen your knowledge and gain more hands-on practice, we recommend taking the following courses:

1. Why is it important to use legends when plotting multiple spectra?

2. How can you visually distinguish between different experiments on a plot?

3. What should you include in a plot to make it suitable for publication?

question mark

Why is it important to use legends when plotting multiple spectra?

Select the correct answer

question mark

How can you visually distinguish between different experiments on a plot?

Select the correct answer

question mark

What should you include in a plot to make it suitable for publication?

Select the correct answer

Var allt tydligt?

Hur kan vi förbättra det?

Tack för dina kommentarer!

Avsnitt 3. Kapitel 5

Fråga AI

expand

Fråga AI

ChatGPT

Fråga vad du vill eller prova någon av de föreslagna frågorna för att starta vårt samtal

Suggested prompts:

Can you explain how to choose the best colors and line styles for accessibility?

How do I add more annotations to highlight other features in the plot?

What are some tips for making scientific plots look more professional?

bookComparing and Presenting Experimental Results

Svep för att visa menyn

When you conduct multiple experiments — such as measuring absorbance spectra from different samples or under varying conditions — it's essential to compare your results effectively. This allows you to identify patterns, differences, or similarities that may reveal important chemical information. By overlaying spectra on a single plot, you can visually assess how changes in conditions or sample composition affect the absorbance at different wavelengths.

1234567891011121314151617181920
import numpy as np import matplotlib.pyplot as plt # Simulated wavelength range (nm) wavelength = np.linspace(200, 800, 300) # Simulated absorbance spectra for three samples abs1 = np.exp(-0.01 * (wavelength - 350) ** 2) * 1.0 abs2 = np.exp(-0.01 * (wavelength - 400) ** 2) * 0.8 abs3 = np.exp(-0.01 * (wavelength - 450) ** 2) * 0.6 plt.figure(figsize=(8, 5)) plt.plot(wavelength, abs1, label="Sample 1") plt.plot(wavelength, abs2, label="Sample 2") plt.plot(wavelength, abs3, label="Sample 3") plt.xlabel("Wavelength (nm)") plt.ylabel("Absorbance") plt.title("Comparison of Absorbance Spectra") plt.legend() plt.show()
copy

When plotting multiple spectra together, it's important to help viewers quickly distinguish between the different experiments. Using a legend is the standard way to label each curve, so anyone reading your plot knows which line corresponds to which sample or condition. Color coding each spectrum and using distinct line styles (such as solid, dashed, or dotted lines) make the plot even clearer, especially if some viewers have color vision deficiencies or if the plot is printed in grayscale.

12345678910111213
plt.figure(figsize=(8, 5)) plt.plot(wavelength, abs1, color="blue", linestyle="-", linewidth=2, label="Sample 1: Control") plt.plot(wavelength, abs2, color="green", linestyle="--", linewidth=2, label="Sample 2: Heated") plt.plot(wavelength, abs3, color="red", linestyle=":", linewidth=2, label="Sample 3: With Additive") plt.xlabel("Wavelength (nm)") plt.ylabel("Absorbance") plt.title("Absorbance Spectra Under Different Conditions") plt.legend(loc="upper right", title="Samples") plt.annotate("Peak shifts", xy=(400, 0.8), xytext=(500, 0.9), arrowprops=dict(facecolor='black', arrowstyle="->"), fontsize=10, color="black") plt.tight_layout() plt.show()
copy

To present scientific results clearly, you should always consider the needs of your audience. Use descriptive axis labels (with units), an informative title, and a legend that explains each curve. Choose colors and line styles that remain distinguishable in both color and black-and-white formats. Annotations can highlight important features, such as peaks or shifts in the spectra, drawing attention to key findings. Consistent formatting across all your figures helps your work appear professional and makes your results easier to interpret.

Note
Study More

In this course, we briefly touched on many Python libraries that are important for effective analysis. To deepen your knowledge and gain more hands-on practice, we recommend taking the following courses:

1. Why is it important to use legends when plotting multiple spectra?

2. How can you visually distinguish between different experiments on a plot?

3. What should you include in a plot to make it suitable for publication?

question mark

Why is it important to use legends when plotting multiple spectra?

Select the correct answer

question mark

How can you visually distinguish between different experiments on a plot?

Select the correct answer

question mark

What should you include in a plot to make it suitable for publication?

Select the correct answer

Var allt tydligt?

Hur kan vi förbättra det?

Tack för dina kommentarer!

Avsnitt 3. Kapitel 5
some-alt