Always show details import matplotlib.pyplot as plt import numpy as np # Create pH values from 0 to 14 pH_values = np.arange(0, 15, 1) # Corresponding colors (rough approximation for litmus/pH paper colors) colors = [ "#ff0000", # 0 - Strong Acid (Red) "#ff3300", # 1 "#ff6600", # 2 "#ff9900", # 3 - Acidic Orange "#ffcc00", # 4 "#ffff00", # 5 - Acidic Yellow "#ccff33", # 6 - Yellow-Green "#00ff00", # 7 - Neutral Green "#33ccff", # 8 - Light Blue (weak base) "#0099ff", # 9 "#0066ff", # 10 "#0000ff", # 11 - Blue (base) "#6600cc", # 12 "#8000ff", # 13 "#9900ff", # 14 - Strong Base (Purple) ] fig, ax = plt.subplots(figsize=(12, 2)) # Create a horizontal bar with pH colors for i, (pH, color) in enumerate(zip(pH_values, colors)): ax.barh(0, 1, left=i, color=color) # Labels and ticks ax.set_xlim(0, 15) ax.set_xticks(np.arange(0, 15, 1)) ax.set_xticklabels([str(i) for i in range(15)]) ax.set_yticks([]) ax.set_title("pH Scale with Colors (0 = Strong Acid → 14 = Strong Base)", fontsize=14, pad=20) plt.show()